Ideal charging / discharging percentage for maximum battery life?
In the comments to linked answer, it was brought out that batteries are not allowed to stay at 100% charge since it is harmful to the battery and the battery % rapidly drops to around 90% as explained in this XDA post. This is a precaution implemented by OEMs ( though not sure if all OEM's do that)
Related to this is battery longevity on terms of Voltage per cell
Source: How to Prolong Lithium-based Batteries

Most Li-ions charge to 4.20V/cell, and every reduction in peak charge voltage of 0.10V/cell is said to double the cycle life....
In terms of longevity, the optimal charge voltage is 3.92V/cell. Battery experts believe that this threshold eliminates all voltage-related stresses;


This voltage as per Table 4  ( above ) corresponds to battery charge level at 58 ℅ .  This is clearly impractical and the recommendation of your friend to charge to 80%, more than doubles the discharge cycles .
This was on the charging part. Table 2 shows another interesting aspect discharging and it's impact on battery life

IMO , if one badly wanted to maximise battery life, ideally, keeping practical usage in mind - charge when the battery drops to 50% and stop charging at 80 or 90%
Thanks to Dmitry in comments who says and subsequently made an interesting point in his answer for the end user is number of charge cycles*capacity at full charge: that's how long a battery will last for a given usage pattern

Edit:  For rooted devices, there is an app on XDA which disconnects charging at a given percentage. This is now open source.  Approach followed appears to be similar to my solution here  Automatically limit (stop) battery charging at a given percentage
Edit 2: Discovered this magisk module which does the same and much more - see Don&#39;t charge the battery but use connected power to run the phone