Commit b70d5b0e authored by Thibault Wittemberg's avatar Thibault Wittemberg Committed by gerrit2
Browse files

call: add connecting animation

Brings a pulse animation on contact avatar while calling
Clears wrong layout instructions and use ButterKnife for views
injections.
We use a different layout file in landscape to better use the available
screen estate.

Change-Id: Ie40f64bc8951b29cfc2c6b1c7640e05de149ccf9
Tuleap: #834
parent 0a4d74ee
......@@ -21,6 +21,7 @@ dependencies {
compile 'com.google.zxing:core:3.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
}
......
......@@ -58,7 +58,7 @@ import cx.ring.utils.CallProximityManager;
import static cx.ring.service.LocalService.Callbacks;
public class CallActivity extends AppCompatActivity implements Callbacks, CallFragment.Callbacks, CallProximityManager.ProximityDirector {
public class CallActivity extends AppCompatActivity implements Callbacks, CallFragment.ConversationCallbacks, CallProximityManager.ProximityDirector {
static final String TAG = CallActivity.class.getSimpleName();
public static final String ACTION_CALL = BuildConfig.APPLICATION_ID + ".action.call";
......@@ -96,7 +96,7 @@ public class CallActivity extends AppCompatActivity implements Callbacks, CallFr
setContentView(R.layout.activity_call_layout);
mMainView = findViewById(R.id.maincalllayout);
mMainView = findViewById(R.id.main_call_layout);
mMainView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -135,6 +135,12 @@ public class CallActivity extends AppCompatActivity implements Callbacks, CallFr
showSystemUI();
}
// Reload a new view
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
mCurrentCallFragment = new CallFragment();
fragmentTransaction.replace(R.id.main_call_layout, mCurrentCallFragment).commit();
super.onConfigurationChanged(newConfig);
}
......@@ -249,7 +255,7 @@ public class CallActivity extends AppCompatActivity implements Callbacks, CallFr
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
mCurrentCallFragment = new CallFragment();
fragmentTransaction.add(R.id.maincalllayout, mCurrentCallFragment).commit();
fragmentTransaction.add(R.id.main_call_layout, mCurrentCallFragment).commit();
hideSystemUI();
}
......
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2004-2016 Savoir-faire Linux Inc.
Author: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".client.CallActivity">
<SurfaceView
android:id="@+id/video_preview_surface"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_gravity="center"
android:visibility="gone" />
<FrameLayout
android:id="@+id/inner_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<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" />
<LinearLayout
android:id="@+id/contact_bubble_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100"
android:orientation="horizontal"
android:layout_marginBottom="16dp">
<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">
<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:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="50"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/contact_bubble_txt"
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" />
<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="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_24dp"
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_24dp"
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" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/call_status_bar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:visibility="visible">
<ViewSwitcher
android:id="@+id/security_switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:visibility="gone">
<Button
android:id="@+id/confirm_sas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/white"
android:textSize="12sp" />
<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_24dp"
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_24dp"
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>
\ No newline at end of file
......@@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software
<cx.ring.views.FitsWindowsLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/maincalllayout"
android:id="@+id/main_call_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cardview_dark_background"
......
......@@ -44,53 +44,76 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:layout_margin="8dp"
android:visibility="gone" />
<LinearLayout
<RelativeLayout
android:id="@+id/contact_bubble_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginBottom="16dp">
<com.skyfishjy.library.RippleBackground
android:id="@+id/ripple_animation"
android:layout_width="230dp"
android:layout_height="230dp"
android:layout_centerInParent="true"
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_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<TextView
android:id="@+id/contact_bubble_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_color_primary_dark" />
<TextView
android:id="@+id/contact_bubble_num_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="middle"
android:gravity="center_horizontal"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_color_secondary_dark" />
<TextView
android:id="@+id/call_status_txt"
android:layout_width="wrap_content"
<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:layout_width="300dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_color_primary_dark"
android:textSize="16sp" />
android:layout_below="@id/ripple_animation"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:orientation="vertical">
</LinearLayout>
<TextView
android:id="@+id/contact_bubble_txt"
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" />
<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="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>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment