* #26597 Better support for sizes and densities
diff --git a/res/layout/frag_call_element.xml b/res/layout/frag_call_element.xml
index 59cdeae..73c389f 100644
--- a/res/layout/frag_call_element.xml
+++ b/res/layout/frag_call_element.xml
@@ -46,22 +46,5 @@
android:layout_centerInParent="true"
android:text="Current Calls" />
- <!-- <Button -->
- <!-- android:id="@+id/button_conf" -->
- <!-- android:layout_width="wrap_content" -->
- <!-- android:layout_height="wrap_content" -->
- <!-- android:layout_above="@+id/phoneNumberTextEntry" -->
- <!-- android:layout_alignParentRight="true" -->
- <!-- android:text="Conference" /> -->
-
-
- <!-- <ToggleButton -->
- <!-- android:id="@+id/switch_hold" -->
- <!-- android:layout_width="wrap_content" -->
- <!-- android:layout_height="wrap_content" -->
- <!-- android:layout_alignParentRight="true" -->
- <!-- android:layout_above="@+id/button_conf" -->
- <!-- android:textOn="Unhold" -->
- <!-- android:textOff="Hold" /> -->
</RelativeLayout>
\ No newline at end of file
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..fd8eb07
--- /dev/null
+++ b/res/values-sw600dp/dimens.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+
+Author: Alexandre Lision <alexandre.lision@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.
+ -->
+
+ <!--
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw600dp devices (e.g. 7" tablets) here.
+ -->
+
+<resources>
+
+
+ <dimen name="bubble_size">150dp</dimen>
+
+</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e72ac9f..3072a1c 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -34,5 +34,7 @@
<dimen name="padding_small">8dp</dimen>
<dimen name="padding_medium">8dp</dimen>
<dimen name="padding_large">16dp</dimen>
+
+ <dimen name="bubble_size">50dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 510af0d..fefdce7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -161,5 +161,9 @@
<string name="action_call_unattended_transfer">Unattended transfer</string>
<string name="action_call_conference">Conference</string>
<string name="action_call_hold">Hold</string>
+ <string name="action_call_unhold">Unhold</string>
+
+ <string name="action_call_record">Record</string>
+ <string name="action_call_stop_record">Stop Recording</string>
</resources>
\ No newline at end of file
diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java b/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
index 13baa15..95d01e9 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
@@ -81,7 +81,9 @@
Bundle b = getArguments();
conf = new Conference((Conference) b.getParcelable("conference"));
model = new BubbleModel(getResources().getDisplayMetrics().density);
- BUBBLE_SIZE = 50 * getResources().getDisplayMetrics().density;
+ BUBBLE_SIZE = getResources().getDimension(R.dimen.bubble_size);
+ Log.e(TAG,"BUBBLE_SIZE "+BUBBLE_SIZE);
+
}
/**
diff --git a/src/com/savoirfairelinux/sflphone/model/Bubble.java b/src/com/savoirfairelinux/sflphone/model/Bubble.java
index 7d9bf2c..927f446 100644
--- a/src/com/savoirfairelinux/sflphone/model/Bubble.java
+++ b/src/com/savoirfairelinux/sflphone/model/Bubble.java
@@ -35,7 +35,7 @@
public long last_drag;
public boolean expanded; // determine if we draw the buttons around the bubble
private Bitmap saved_photo;
- private float expanded_radius = 250;
+ private float expanded_radius;
public void setAttractor(PointF attractor) {
this.attractor = attractor;
@@ -56,6 +56,7 @@
associated_call = call;
pos.set(x, y);
radius = internalBMP.getWidth() / 2;
+ expanded_radius = (float) (size * 1.5);
bounds = new RectF(pos.x - radius, pos.y - radius, pos.x + radius, pos.y + radius);
attractor = new PointF(x, y);
@@ -142,9 +143,8 @@
this.density = density;
}
- public void expand(int i) {
+ public void expand() {
- expanded_radius = i;
expanded = true;
internalBMP = Bitmap.createScaledBitmap(saved_photo, (int) (2 * radius), (int) (2 * radius), false);
@@ -260,4 +260,26 @@
}
return 0;
}
+
+ /**
+ * Always return the normal radius of the bubble
+ * @return
+ */
+ public float getRetractedRadius() {
+ return radius;
+ }
+
+ public int getHoldStatus() {
+ if(associated_call.isOnHold())
+ return R.string.action_call_unhold;
+ else
+ return R.string.action_call_hold;
+ }
+
+ public int getRecordStatus() {
+ if(associated_call.isRecording())
+ return R.string.action_call_stop_record;
+ else
+ return R.string.action_call_record;
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/model/BubblesView.java b/src/com/savoirfairelinux/sflphone/model/BubblesView.java
index d019a7b..077f1bf 100644
--- a/src/com/savoirfairelinux/sflphone/model/BubblesView.java
+++ b/src/com/savoirfairelinux/sflphone/model/BubblesView.java
@@ -268,25 +268,26 @@
for (int i = 0, n = bubbles.size(); i < n; i++) {
Bubble b = bubbles.get(i);
canvas.drawBitmap(b.getBitmap(), null, b.getBounds(), null);
- canvas.drawText(b.associated_call.getContact().getmDisplayName(), b.getPosX(), b.getPosY() - 40 * density, getNamePaint(b));
+ canvas.drawText(b.associated_call.getContact().getmDisplayName(), b.getPosX(),
+ (float) (b.getPosY() - b.getRetractedRadius() * 1.5 * 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(), first_plan.getPosY() - 50
- * density, getNamePaint(first_plan));
- canvas.drawText("Transfer", first_plan.getPosX(), first_plan.getPosY() + 70 * density, getNamePaint(first_plan));
- if (first_plan.associated_call.isOnHold()) {
- canvas.drawText("Unhold", first_plan.getPosX() - 70 * density, first_plan.getPosY(), getNamePaint(first_plan));
- } else {
- canvas.drawText("Hold", first_plan.getPosX() - 70 * density, first_plan.getPosY(), getNamePaint(first_plan));
- }
- if (first_plan.associated_call.isRecording()) {
- canvas.drawText("Stop\nRecording", first_plan.getPosX() + 70 * density, first_plan.getPosY(), getNamePaint(first_plan));
- } else {
- canvas.drawText("Record", first_plan.getPosX() + 70 * density, first_plan.getPosY(), getNamePaint(first_plan));
+
+ canvas.drawText(first_plan.associated_call.getContact().getmDisplayName(), first_plan.getPosX(),
+ (float) (first_plan.getPosY() - first_plan.getRetractedRadius() * 1.5 * density), getNamePaint(first_plan));
+
+ canvas.drawText("Transfer", first_plan.getPosX(), (float) (first_plan.getPosY() + first_plan.getRetractedRadius() * 1.5
+ * density), getNamePaint(first_plan));
- }
+ canvas.drawText(getResources().getString(first_plan.getHoldStatus()),
+ (float) (first_plan.getPosX() - first_plan.getRetractedRadius() * 1.5 * density), first_plan.getPosY(),
+ getNamePaint(first_plan));
+
+ canvas.drawText(getResources().getString(first_plan.getRecordStatus()),
+ (float) (first_plan.getPosX() + first_plan.getRetractedRadius() * 1.5 * density), first_plan.getPosY(),
+ getNamePaint(first_plan));
}
@@ -431,7 +432,7 @@
Log.d("Main", "onLongPress");
if (isDraggingBubble()) {
Bubble b = getDraggedBubble(e);
- b.expand((int) (100 * getResources().getDisplayMetrics().density));
+ b.expand();
}
}