From the Fallout Wiki:
Lowering the affinity to a sufficient negative value will displease the companion, and they will issue a single warning to the Sole Survivor, asking them to change ways. If the affinity value drops further, they will become angry and refuse to travel with the Sole Survivor. This decision is permanent.
From the wiki article Home Sweet Home, it also states:
Preston Garvey will instantly hate the player after establishing the first raider outpost, even if his affinity has already been maxed and the United We Stand perk unlocked. This is understandable given that the goals of the Nuka-World gangs are directly opposed to the Minutemen's settlement-related activities. Even if Garvey is not the active companion at the time, he will find out about it and become hostile the next time he sees you. He can still be ordered to move to other Minutemen-allied settlements from the workshop menu.
However, Preston does not become hostile after meeting with him. He automatically walked up to me in the settlement I have him staying at and triggered a dialogue. After the dialogue, he does not attack (not matter what options you select), and you can no longer initiate a conversation with him. I've tested this on Xbox One.
It is not possible to get him to like you once again. He will not attack you, but he will simply ignore and hate you. If you really want him back, you will have to reload a previous save before you took over a settlement with raiders.