Skip to content
Snippets Groups Projects
Commit 13cde0b5 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

Fake action bar for the call view

parent c9c424d6
No related branches found
No related tags found
No related merge requests found
res/drawable-xhdpi/ab_stacked_solid_light_holo.9.png

163 B

res/drawable-xhdpi/device_access_call.png

1.98 KiB

res/drawable-xhdpi/device_access_dial_pad.png

1.68 KiB

......@@ -31,18 +31,19 @@ as that of the covered work.
-->
<com.savoirfairelinux.sflphone.views.CallPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slidingpanelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:id="@+id/slidingpanelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/calllist_pane"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/calllist_pane"
android:layout_width="230dp"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/ongoingcall_pane"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/ongoingcall_pane"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</com.savoirfairelinux.sflphone.views.CallPaneLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.savoirfairelinux.sflphone.model.BubblesView
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:focusable="true" />
</RelativeLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
style="?android:attr/actionBarSplitStyle"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@drawable/ab_stacked_solid_light_holo" >
<ImageView
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="left"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:src="@drawable/device_access_call" />
<TextView
android:id="@+id/call_status_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/button1"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#333333" />
<ImageButton
android:id="@+id/dialpad_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="#00000000"
android:src="@drawable/device_access_dial_pad" />
</RelativeLayout>
<com.savoirfairelinux.sflphone.model.BubblesView
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:focusable="true" />
</LinearLayout>
\ No newline at end of file
......@@ -78,19 +78,6 @@ public class CallActivity extends Activity implements CallInterface, CallFragmen
CallListFragment mCallsFragment;
CallFragment mCurrentCallFragment;
// private CallPagerAdapter mCallPagerAdapter;
// private ViewPager mViewPager;
/*
* private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
*
* @Override public void onReceive(Context context, Intent intent) { String signalName = intent.getStringExtra(CallManagerCallBack.SIGNAL_NAME);
* Log.d(TAG, "Signal received: " + signalName);
*
* if (signalName.equals(CallManagerCallBack.NEW_CALL_CREATED)) { } else if (signalName.equals(CallManagerCallBack.CALL_STATE_CHANGED)) {
* processCallStateChangedSignal(intent); } else if (signalName.equals(CallManagerCallBack.INCOMING_CALL)) { } } };
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -103,6 +90,7 @@ public class CallActivity extends Activity implements CallInterface, CallFragmen
getFragmentManager().beginTransaction().replace(R.id.calllist_pane, mCallsFragment).commit();
slidingPaneLayout = (CallPaneLayout) findViewById(R.id.slidingpanelayout);
//slidingPaneLayout.
// slidingPaneLayout.requestDisallowInterceptTouchEvent(disallowIntercept)
slidingPaneLayout.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
......
......@@ -40,9 +40,10 @@ import android.graphics.BitmapFactory;
import android.graphics.PointF;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
......@@ -57,7 +58,7 @@ import com.savoirfairelinux.sflphone.model.CallContact;
import com.savoirfairelinux.sflphone.model.SipCall;
import com.savoirfairelinux.sflphone.service.ISipService;
public class CallFragment extends Fragment {
public class CallFragment extends Fragment implements Callback {
static final String TAG = "CallFragment";
......@@ -66,18 +67,14 @@ public class CallFragment extends Fragment {
private SipCall mCall;
private ViewGroup rootView;
private TextView callStatusTxt;
private BubblesView view;
private BubbleModel model;
private PointF screenCenter;
private DisplayMetrics metrics;
private Callbacks mCallbacks = sDummyCallbacks;
private HashMap<CallContact, Bubble> contacts = new HashMap<CallContact, Bubble>();
private TextView contact_name_txt;
private CallContact myself = CallContact.ContactBuilder.buildUserContact("Me");
private Bitmap hangup_icon;
......@@ -87,8 +84,8 @@ public class CallFragment extends Fragment {
public void onCreate(Bundle savedBundle) {
super.onCreate(savedBundle);
model = new BubbleModel(getResources().getDisplayMetrics().density);
metrics = getResources().getDisplayMetrics();
screenCenter = new PointF(metrics.widthPixels / 2, metrics.heightPixels / 3);
//metrics = getResources().getDisplayMetrics();
//screenCenter = new PointF(metrics.widthPixels / 2, metrics.heightPixels / 3);
Bundle b = getArguments();
......@@ -191,52 +188,31 @@ public class CallFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false);
//rootView.requestDisallowInterceptTouchEvent(true);
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false);
view = (BubblesView) rootView.findViewById(R.id.main_view);
view.setModel(model);
view.getHolder().addCallback(this);
callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
hangup_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_hangup);
call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_call);
Log.i(TAG, "Starting fragment for call " + mCall.getCallId());
mCall.printCallInfo();
if (mCall.isIncoming() && mCall.isRinging()) {
initIncomingCallDisplay();
} else {
if (mCall.isRinging()) {
initOutGoingCallDisplay();
}
try {
if (mCall.isOutGoing() && mCallbacks.getService().getCall(mCall.getCallId()) == null) {
mCallbacks.getService().placeCall(mCall);
initOutGoingCallDisplay();
} else if(mCall.isOutGoing() && mCall.isRinging()){
initOutGoingCallDisplay();
}
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
}
if(mCall.isOngoing()){
initNormalStateDisplay();
}
// Do nothing here, the view is not initialized yet.
return rootView;
}
private void initNormalStateDisplay() {
Log.i(TAG, "Start normal display");
Bubble contact_bubble = getBubbleFor(mCall.getContacts().get(0), screenCenter.x, screenCenter.y);
Bubble me = getBubbleFor(myself, screenCenter.x, screenCenter.y * 3 / 2);
callStatusTxt.setText("0 min");
getBubbleFor(mCall.getContacts().get(0), model.width/2, model.height/2);
getBubbleFor(myself, model.width/2, model.height/3);
model.clearAttractors();
model.addAttractor(new Attractor(new PointF(metrics.widthPixels / 2, metrics.heightPixels * .8f), ATTRACTOR_SIZE, new Attractor.Callback() {
model.addAttractor(new Attractor(new PointF(model.width / 2, model.height * .8f), ATTRACTOR_SIZE, new Attractor.Callback() {
@Override
public boolean onBubbleSucked(Bubble b) {
Log.w(TAG, "Bubble sucked ! ");
......@@ -245,23 +221,26 @@ public class CallFragment extends Fragment {
return true;
}
}, hangup_icon));
}
private void initIncomingCallDisplay() {
Log.i(TAG, "Start incoming display");
Bubble contact_bubble = getBubbleFor(mCall.getContacts().get(0), screenCenter.x, screenCenter.y);
callStatusTxt.setText("Incomming call");
Bubble contact_bubble = getBubbleFor(mCall.getContacts().get(0), model.width/2, model.height/2);
contacts.put(mCall.getContacts().get(0), contact_bubble);
model.clearAttractors();
model.addAttractor(new Attractor(new PointF(4 * metrics.widthPixels / 5, screenCenter.y), ATTRACTOR_SIZE, new Attractor.Callback() {
model.addAttractor(new Attractor(new PointF(4 * model.width / 5, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() {
@Override
public boolean onBubbleSucked(Bubble b) {
mCallbacks.onCallAccepted(mCall);
return false;
}
}, call_icon));
model.addAttractor(new Attractor(new PointF(metrics.widthPixels / 5, screenCenter.y), ATTRACTOR_SIZE, new Attractor.Callback() {
model.addAttractor(new Attractor(new PointF(model.width / 5, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() {
@Override
public boolean onBubbleSucked(Bubble b) {
mCallbacks.onCallRejected(mCall);
......@@ -273,11 +252,14 @@ public class CallFragment extends Fragment {
private void initOutGoingCallDisplay() {
Log.i(TAG, "Start outgoing display");
callStatusTxt.setText("Calling...");
// TODO off-thread image loading
Bubble contact_bubble = getBubbleFor(mCall.getContacts().get(0), screenCenter.x, screenCenter.y);
getBubbleFor(mCall.getContacts().get(0), model.width/2, model.height/2);
model.clearAttractors();
model.addAttractor(new Attractor(new PointF(metrics.widthPixels / 2, metrics.heightPixels * .8f), 40, new Attractor.Callback() {
model.addAttractor(new Attractor(new PointF(model.width / 2, model.height * .8f), 40, new Attractor.Callback() {
@Override
public boolean onBubbleSucked(Bubble b) {
Log.w(TAG, "Bubble sucked ! ");
......@@ -348,4 +330,45 @@ public class CallFragment extends Fragment {
return view == null ? false : view.isDraggingBubble();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
Log.i(TAG, "Init fragment " + mCall.getCallId());
mCall.printCallInfo();
if (mCall.isIncoming() && mCall.isRinging()) {
initIncomingCallDisplay();
} else {
if (mCall.isRinging()) {
initOutGoingCallDisplay();
}
try {
if (mCall.isOutGoing() && mCallbacks.getService().getCall(mCall.getCallId()) == null) {
mCallbacks.getService().placeCall(mCall);
initOutGoingCallDisplay();
} else if(mCall.isOutGoing() && mCall.isRinging()){
initOutGoingCallDisplay();
}
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
}
if(mCall.isOngoing()){
initNormalStateDisplay();
}
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{
}
@Override
public void surfaceDestroyed(SurfaceHolder holder)
{
}
}
......@@ -138,7 +138,6 @@ public class BubbleModel
float a = (dist-attractor_stall_dist)/(attractor_smooth_dist-attractor_stall_dist);
b.target_scale = a*.8f+.2f;
}
}
// border repulsion
......@@ -153,7 +152,6 @@ public class BubbleModel
b.speed.y -= dt * border_repulsion;
}
b.speed.x += dt * target_speed * tdx/dist;
b.speed.y += dt * target_speed * tdy/dist;
......
......@@ -87,7 +87,7 @@ public class BubblesView extends SurfaceView implements SurfaceHolder.Callback,
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
Log.w(TAG, "surfaceChanged");
Log.w(TAG, "surfaceChanged "+width+"-"+height);
thread.setSurfaceSize(width, height);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment