CallFragment: add MVP model
Refactor CallFragment by adding MVP model, moving video management from
RingApplication to HardwareServiceImpl and removing use of
VideoCallbackManager
Change-Id: Ie75a0d33fa138590911d19d113df362ade29b9f4
Reviewed-by: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Tuleap: #1360
diff --git a/ring-android/app/src/main/res/layout-land/frag_call.xml b/ring-android/app/src/main/res/layout-land/frag_call.xml
index 277abde..8bbabda 100644
--- a/ring-android/app/src/main/res/layout-land/frag_call.xml
+++ b/ring-android/app/src/main/res/layout-land/frag_call.xml
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -27,184 +27,144 @@
android:id="@+id/video_preview_surface"
android:layout_width="match_parent"
android:layout_height="32dp"
+ android:layout_centerInParent="true"
android:layout_gravity="center"
- android:visibility="gone" />
+ android:visibility="gone"
+ tools:visibility="visible" />
- <FrameLayout
- android:id="@+id/inner_layout"
+ <SurfaceView
+ android:id="@+id/camera_preview_surface"
+ android:layout_width="160dp"
+ android:layout_height="120dp"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_margin="8dp"
+ android:visibility="gone"
+ tools:visibility="visible" />
+
+ <LinearLayout
+ android:id="@+id/contact_bubble_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:fitsSystemWindows="true">
+ android:layout_marginBottom="16dp"
+ android:orientation="horizontal"
+ android:weightSum="100">
- <SurfaceView
- android:id="@+id/camera_preview_surface"
- android:layout_width="160dp"
- android:layout_height="120dp"
- android:layout_gravity="bottom|end"
- android:layout_margin="8dp"
- android:visibility="gone" />
+ <com.skyfishjy.library.RippleBackground
+ android:id="@+id/ripple_animation"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="50"
+ app:rb_color="@color/white"
+ app:rb_duration="5000"
+ app:rb_radius="20dp"
+ app:rb_rippleAmount="3"
+ app:rb_scale="6">
+
+ <ImageView
+ android:id="@+id/contact_bubble"
+ android:layout_width="160dp"
+ android:layout_height="160dp"
+ android:layout_centerInParent="true"
+ tools:src="@drawable/ic_contact_picture" />
+ </com.skyfishjy.library.RippleBackground>
<LinearLayout
- android:id="@+id/contact_bubble_layout"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="match_parent"
- android:weightSum="100"
- android:orientation="horizontal"
- android:layout_marginBottom="16dp">
+ android:layout_margin="10dp"
+ android:layout_weight="50"
+ android:gravity="center"
+ android:orientation="vertical">
- <com.skyfishjy.library.RippleBackground
- android:id="@+id/ripple_animation"
- android:layout_width="0dp"
- android:layout_weight="50"
- android:layout_height="match_parent"
- app:rb_color="@color/white"
- app:rb_duration="5000"
- app:rb_radius="20dp"
- app:rb_rippleAmount="3"
- app:rb_scale="6">
+ <TextView
+ android:id="@+id/contact_bubble_txt"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:ellipsize="middle"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="@color/text_color_primary_dark"
+ tools:text="Contact Name" />
- <ImageView
- android:id="@+id/contact_bubble"
- android:layout_width="160dp"
- android:layout_height="160dp"
- android:layout_centerInParent="true"
- tools:src="@drawable/ic_contact_picture" />
- </com.skyfishjy.library.RippleBackground>
+ <TextView
+ android:id="@+id/contact_bubble_num_txt"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:ellipsize="middle"
+ android:paddingEnd="32dp"
+ android:paddingStart="32dp"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/text_color_secondary_dark"
+ tools:text="ring:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
+
+ <TextView
+ android:id="@+id/call_status_txt"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:textColor="@color/text_color_primary_dark"
+ android:textSize="16sp"
+ tools:text="Connecting" />
<LinearLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:gravity="center"
- android:layout_weight="50"
- android:layout_margin="10dp"
- android:orientation="vertical">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="12dp"
+ android:orientation="horizontal">
- <TextView
- android:id="@+id/contact_bubble_txt"
+ <android.support.design.widget.FloatingActionButton
+ android:id="@+id/call_refuse_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="@color/text_color_primary_dark"
- tools:text="Contact Name" />
+ android:layout_margin="16dp"
+ android:contentDescription="@string/action_call_decline"
+ android:src="@drawable/ic_call_end_white"
+ app:backgroundTint="@color/error_red"
+ app:elevation="6dp"
+ app:pressedTranslationZ="12dp"
+ app:rippleColor="@android:color/white" />
- <TextView
- android:id="@+id/contact_bubble_num_txt"
+ <android.support.design.widget.FloatingActionButton
+ android:id="@+id/call_accept_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:ellipsize="end"
- android:paddingEnd="32dp"
- android:paddingStart="32dp"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/text_color_secondary_dark"
- tools:text="ring:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
-
- <TextView
- android:id="@+id/call_status_txt"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:textColor="@color/text_color_primary_dark"
- android:textSize="16sp"
- tools:text="Connecting" />
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="12dp"
- android:orientation="horizontal">
-
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/call_refuse_btn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="16dp"
- android:contentDescription="@string/action_call_decline"
- android:src="@drawable/ic_call_end_white"
- app:backgroundTint="@color/error_red"
- app:elevation="6dp"
- app:pressedTranslationZ="12dp"
- app:rippleColor="@android:color/white" />
-
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/call_accept_btn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="16dp"
- android:contentDescription="@string/action_call_accept"
- android:src="@drawable/ic_call_white"
- app:backgroundTint="#4caf50"
- app:elevation="6dp"
- app:pressedTranslationZ="12dp"
- app:rippleColor="@android:color/white" />
- </LinearLayout>
-
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/imageView"
- android:layout_gravity="center_horizontal" />
+ android:layout_margin="16dp"
+ android:contentDescription="@string/action_call_accept"
+ android:src="@drawable/ic_call_white"
+ app:backgroundTint="#4caf50"
+ app:elevation="6dp"
+ app:pressedTranslationZ="12dp"
+ app:rippleColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
+ </LinearLayout>
- <RelativeLayout
- android:id="@+id/call_status_bar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:visibility="visible">
+ <android.support.design.widget.FloatingActionButton
+ android:id="@+id/call_hangup_btn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="48dp"
+ android:src="@drawable/ic_call_end_white"
+ app:backgroundTint="@color/error_red"
+ app:elevation="6dp"
+ app:pressedTranslationZ="12dp"
+ app:rippleColor="@android:color/white" />
- <ViewSwitcher
- android:id="@+id/security_switcher"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:visibility="gone">
+ <EditText
+ android:id="@+id/dialpad_edit_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="phone"
+ android:visibility="visible" />
- <ImageView
- android:id="@+id/lock_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end|center_vertical" />
- </ViewSwitcher>
-
- <ImageView
- android:id="@+id/security_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:layout_margin="16dp"
- android:src="@drawable/ic_lock_white"
- android:tint="#4caf50"
- android:visibility="gone" />
-
- </RelativeLayout>
-
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/call_hangup_btn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_margin="28dp"
- android:src="@drawable/ic_call_end_white"
- app:backgroundTint="@color/error_red"
- app:elevation="6dp"
- app:pressedTranslationZ="12dp"
- app:rippleColor="@android:color/white" />
-
- <EditText
- android:id="@+id/dialpad_edit_text"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:ems="10"
- android:inputType="phone"
- android:visibility="visible" />
-
- </FrameLayout>
-</FrameLayout>
+</RelativeLayout>