* #26597 Better support for sizes and densities
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();
}
}