Skip to content
Snippets Groups Projects
Commit 465ceba1 authored by alision's avatar alision
Browse files

* #26787 Replaced buttons by DnD

parent 91d28596
No related branches found
No related tags found
No related merge requests found
Showing
with 383 additions and 284 deletions
File moved
File moved
File moved
......@@ -5,10 +5,12 @@
android:background="@color/lighter_gray"
android:orientation="vertical" >
<ExpandableListView
<ListView
android:id="@+id/call_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
android:layout_height="wrap_content"
android:choiceMode="singleChoice"
android:clickable="true" >
</ListView>
</LinearLayout>
\ No newline at end of file
......@@ -49,7 +49,6 @@
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:background="@drawable/call_button"
android:gravity="center_vertical"
android:src="@drawable/ic_call" />
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
Author: Adrien Beraud <adrien.beraud@gmail.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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Additional permission under GNU GPL version 3 section 7:
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
grants you additional permission to convey the resulting work.
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="8dp"
android:background="@color/lighter_gray"
android:paddingRight="8dp" >
<Button
android:id="@+id/access_callactivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Current Calls" />
</RelativeLayout>
\ No newline at end of file
......@@ -9,8 +9,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/expand_button"
android:clickable="true" >
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/num_participants" >
<TextView
android:id="@+id/call_title"
......@@ -18,6 +18,10 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="call_title"
android:textSize="20sp" />
......@@ -34,22 +38,32 @@
android:id="@+id/call_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/call_status"
android:layout_below="@+id/call_title"
android:layout_toRightOf="@+id/call_status"
android:paddingLeft="10dp"
android:text="call_time"
android:textSize="12sp" />
</RelativeLayout>
<ImageButton
android:id="@+id/expand_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<TextView
android:id="@+id/num_participants"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@null"
android:focusable="false"
android:focusableInTouchMode="false"
android:src="@drawable/up_arrow" />
android:layout_centerHorizontal="true"
android:background="@drawable/call_button"
android:gravity="center"
android:text="0"
android:textSize="30sp" />
<!-- <ImageButton -->
<!-- android:id="@+id/expand_button" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_alignParentRight="true" -->
<!-- android:layout_centerVertical="true" -->
<!-- android:background="@null" -->
<!-- android:focusable="false" -->
<!-- android:src="@drawable/up_arrow" /> -->
</RelativeLayout>
\ No newline at end of file
......@@ -72,6 +72,12 @@ as that of the covered work.
</string-array>
<string-array name="drop_actions">
<item>@string/action_call_attended_transfer</item>
<item>@string/action_call_conference</item>
</string-array>
......
......@@ -256,6 +256,7 @@ public class CallActivity extends Activity implements CallInterface, CallFragmen
mCallsFragment.update();
if(mCurrentCallFragment != null)
mCurrentCallFragment.changeCallState(callID, newState);
try {
......@@ -469,6 +470,7 @@ public class CallActivity extends Activity implements CallInterface, CallFragmen
public void replaceCurrentCallDisplayed() {
mCurrentCallFragment.getBubbleView().stopThread();
getFragmentManager().beginTransaction().remove(mCurrentCallFragment).commit();
mCurrentCallFragment = null;
}
......
......@@ -360,12 +360,15 @@ public class SFLPhoneHomeActivity extends Activity implements DialingFragment.Ca
Log.i(TAG, "Launch Call Activity");
Bundle bundle = new Bundle();
Conference tmp = new Conference("-1");
tmp.getParticipants().add(infos);
bundle.putParcelable("conference", tmp);
Intent intent = new Intent().setClass(this, CallActivity.class);
intent.putExtra("resuming", false);
intent.putExtras(bundle);
startActivityForResult(intent, REQUEST_CODE_CALL);
overridePendingTransition(R.anim.slide_down, R.anim.slide_up);
}
/** Defines callbacks for service binding, passed to bindService() */
......@@ -425,6 +428,7 @@ public class SFLPhoneHomeActivity extends Activity implements DialingFragment.Ca
break;
case REQUEST_CODE_CALL:
Log.w(TAG, "Result out of CallActivity");
if (mSectionsPagerAdapter.getItem(2) != null)
getLoaderManager().restartLoader(LoaderConstants.HISTORY_LOADER, null, (HistoryFragment) mSectionsPagerAdapter.getItem(2));
break;
}
......
......@@ -221,7 +221,7 @@ public class CallFragment extends Fragment implements Callback {
int angle_part = 360 / conf.getParticipants().size();
double dX = 0;
double dY = 0;
int radiusCalls = model.width / 2 - 150;
int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE);
for (int i = 0; i < conf.getParticipants().size(); ++i) {
if (conf.getParticipants().get(i) == null) {
......@@ -311,13 +311,13 @@ public class CallFragment extends Fragment implements Callback {
callStatusTxt.setText("Calling...");
getBubbleFor(myself, model.width / 2, model.height / 2);
getBubbleFor(myself, model.width / 2, (float) (model.height / 1.2));
// TODO off-thread image loading
int angle_part = 360 / conf.getParticipants().size();
double dX = 0;
double dY = 0;
int radiusCalls = model.width / 2 - 150;
int radiusCalls = (int) ((model.width / 2 - BUBBLE_SIZE));
for (int i = 0; i < conf.getParticipants().size(); ++i) {
dX = Math.cos(Math.toRadians(angle_part * i - 90)) * radiusCalls;
dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls;
......@@ -415,9 +415,7 @@ public class CallFragment extends Fragment implements Callback {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
// Log.i(TAG, "Init fragment " + mCall.getCallId());
// mCall.printCallInfo();
if (conf.getParticipants().size() == 1) {
if (conf.getParticipants().get(0).isIncoming() && conf.getParticipants().get(0).isRinging()) {
......
......@@ -67,8 +67,8 @@ public class ConferenceDFragment extends DialogFragment implements LoaderManager
Intent in = new Intent();
in.putExtra("call_to_add", call_selected);
in.putExtra("call_target", mAdapter.getItem(pos));
in.putExtra("transfer", call_selected);
in.putExtra("target", mAdapter.getItem(pos));
getTargetFragment().onActivityResult(getTargetRequestCode(), 0, in);
dismiss();
}
......
......@@ -149,7 +149,7 @@ public class HomeFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.i(TAG, "onCreateView");
View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
View inflatedView = inflater.inflate(R.layout.frag_home, container, false);
access_calls = (Button) inflatedView.findViewById(R.id.access_callactivity);
......
......@@ -168,19 +168,6 @@ public class Bubble {
canvas.drawBitmap(circle, 0, 0, circlePaint);
circle_drawer.drawOval(new RectF(0, 0, internalBMP.getWidth(), internalBMP.getHeight()), circlePaint);
int[] allpixels = new int[internalBMP.getHeight() * internalBMP.getWidth()];
internalBMP.getPixels(allpixels, 0, internalBMP.getWidth(), 0, 0, internalBMP.getWidth(), internalBMP.getHeight());
for (int i = 0; i < internalBMP.getHeight() * internalBMP.getWidth(); i++) {
// Log.i("Bubble", "allpixels[i]:"+allpixels[i]);
if (allpixels[i] == Color.BLACK) {
Log.i("Bubble", "replacing color");
allpixels[i] = 0xAA000000;
}
}
internalBMP.setPixels(allpixels, 0, internalBMP.getWidth(), 0, 0, internalBMP.getWidth(), internalBMP.getHeight());
externalBMP = Bitmap.createBitmap((int) (getRadius() * 2), (int) (getRadius() * 2), Bitmap.Config.ARGB_8888);
Canvas canvasf = new Canvas(externalBMP);
......@@ -194,6 +181,19 @@ public class Bubble {
fatality.setStyle(Paint.Style.FILL);
canvasf.drawOval(new RectF(0, 0, getRadius() * 2, getRadius() * 2), mPaintPath); // background with buttons
int[] allpixels = new int[internalBMP.getHeight() * internalBMP.getWidth()];
internalBMP.getPixels(allpixels, 0, internalBMP.getWidth(), 0, 0, internalBMP.getWidth(), internalBMP.getHeight());
for (int i = 0; i < internalBMP.getHeight() * internalBMP.getWidth(); i++) {
// Log.i("Bubble", "allpixels[i]:"+allpixels[i]);
if (allpixels[i] == Color.BLACK) {
Log.i("Bubble", "replacing color");
allpixels[i] = 0xAA000000;
}
}
internalBMP.setPixels(allpixels, 0, internalBMP.getWidth(), 0, 0, internalBMP.getWidth(), internalBMP.getHeight());
canvasf.drawBitmap(internalBMP, (float) (getRadius() - radius), (float) (getRadius() - radius), fatality);
}
......
......@@ -185,12 +185,6 @@ public class BubbleModel
public Bubble getBubble(SipCall call) {
for(Bubble b : bubbles){
if(call == null){
Log.e(TAG, "call null");
}
if(b.associated_call.getCallId() == null){
Log.e(TAG, "id null");
}
if(b.associated_call.getCallId().contentEquals(call.getCallId()))
return b;
}
......
......@@ -267,16 +267,19 @@ public class BubblesView extends SurfaceView implements SurfaceHolder.Callback,
for (int i = 0, n = bubbles.size(); i < n; i++) {
Bubble b = bubbles.get(i);
if(b.expanded){
continue;
}
canvas.drawBitmap(b.getBitmap(), null, b.getBounds(), null);
canvas.drawText(b.associated_call.getContact().getmDisplayName(), b.getPosX(),
(float) (b.getPosY() - b.getRetractedRadius() * 1.5 * density), getNamePaint(b));
(float) (b.getPosY() - b.getRetractedRadius() * 1.2 * density), getNamePaint(b));
}
Bubble first_plan = getExpandedBubble();
if (first_plan != null) {
canvas.drawBitmap(first_plan.getBitmap(), null, first_plan.getBounds(), null);
canvas.drawText(first_plan.associated_call.getContact().getmDisplayName(), first_plan.getPosX(),
(float) (first_plan.getPosY() - first_plan.getRetractedRadius() * 1.5 * density), getNamePaint(first_plan));
(float) (first_plan.getPosY() - first_plan.getRetractedRadius() * 1.2 * density), getNamePaint(first_plan));
canvas.drawText("Transfer", first_plan.getPosX(), (float) (first_plan.getPosY() + first_plan.getRetractedRadius() * 1.5
* density), getNamePaint(first_plan));
......
......@@ -49,7 +49,7 @@ public class CallContact implements Parcelable {
private CallContact(long cID, String displayName, long photoID, ArrayList<Phone> p, ArrayList<Phone> sip, String mail, boolean user) {
id = cID;
mDisplayName = displayName.substring(0, displayName.length() > 10 ? 10 : displayName.length());
mDisplayName = displayName;
phones = p;
sip_phones = sip;
mEmail = mail;
......
......@@ -108,6 +108,28 @@ public class Conference implements Parcelable {
return null;
}
/**
* Compare conferences based on confID/participants
*/
@Override
public boolean equals(Object c) {
if (c instanceof Conference) {
if(((Conference) c).id.contentEquals(id) && !id.contentEquals("-1")){
return true;
} else {
if(((Conference) c).id.contentEquals(id)){
for (int i = 0; i < participants.size(); ++i) {
if (!((Conference) c).contains(participants.get(i).getCallId()))
return false;
}
return true;
}
}
}
return false;
}
public boolean hasMultipleParticipants() {
return participants.size() > 1;
}
......
......@@ -349,7 +349,7 @@ public class SipCall implements Parcelable {
*/
@Override
public boolean equals(Object c) {
if (c instanceof SipCall && ((SipCall) c).mCallID == mCallID) {
if (c instanceof SipCall && ((SipCall) c).mCallID.contentEquals((mCallID))) {
return true;
}
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment