Find posterior distribution and Bayes estimator Suppose that an observation $x \in (-1,1)$  comes from a sample model with a parameter $\theta$, with density function:
$$
f(x\mid\theta) = \begin{cases}
 \theta\ &\text{if }\ -1 < x < 0\\
      1 - \theta\ &\text{if}\ 0 \leqslant x < 1
\end{cases}\
$$
a) Suppose that the prior distribution for $\theta$ is uniform over the interval $(0,1)$.
Find a Bayes estimator associated with this priori distribution, under the quadratic loss function.
I think for this question, we need to find $E(\theta\mid x)$; here is what I got:
$$
f(\theta\mid x) = \begin{cases}
 \theta\ &\text{if }\ -1 < x < 0\\
      1 - \theta\ &\text{if }\ 0 \leqslant x < 1
\end{cases}\
$$
since the prior distribution is $\pi (\theta) = 1$. But I'm unsure how to continue.

For starters, let's simplify the problem by defining the observable variables:
$$y = |x| \quad \quad \quad \quad \quad s = \mathbb{I}(x < 0).$$
There is a one-to-one mapping $x \leftrightarrow (y,s)$ so observing the latter pair of variables is equivalent to observing $x$.  You then have a model with conditionally independent observations $y \ \bot \ s | \theta$ and with distributions:
$$\begin{align}
y | \theta &\sim \text{U}(0,1), \\[6pt]
s | \theta &\sim \text{Bern}(\theta), \\[6pt]
\theta &\sim \text{U}(0,1). \\[6pt]
\end{align}$$
It is clear that $y$ is an ancillary statistic in this model so it adds nothing to the inference.  In any case, the posterior distribution can be derived using Bayes rule in the usual manner:
$$\begin{align}
\pi(\theta| y,s)
&\propto p(y,s|\theta) \cdot \pi(\theta) \\[6pt]
&= p(y|\theta) \cdot p(s|\theta) \cdot \pi(\theta) \\[6pt]
&= \mathbb{I}(0 \leqslant y \leqslant 1) \cdot \theta^s (1-\theta)^{1-s} \cdot \mathbb{I}(0 \leqslant \theta \leqslant 1) \\[6pt]
&\propto \theta^s (1-\theta)^{1-s} \cdot \mathbb{I}(0 \leqslant \theta \leqslant 1) \\[6pt]
&\propto \text{Beta}(\theta | s+1, 2-s). \\[6pt]
\end{align}$$
The remaining parts can be derived from the posterior distribution, which I will leave to you.
