* #34491: lines and touch area adjusted
diff --git a/res/values/colors.xml b/res/values/colors.xml
index dbad7b4..bfacfa6 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -50,4 +50,6 @@
<color name="holo_blue_bright">#ff00ddff</color>
+ <color name="transparent_grey">#AACCCCCC</color>
+
</resources>
diff --git a/src/org/sflphone/model/Bubble.java b/src/org/sflphone/model/Bubble.java
index 63b7d83..7cb8cef 100644
--- a/src/org/sflphone/model/Bubble.java
+++ b/src/org/sflphone/model/Bubble.java
@@ -202,12 +202,28 @@
int mWidth, mHeight;
RectF bounds;
Bitmap img;
+ Paint mLines;
+ Paint mBackgroundPaint;
+ Paint mButtonPaint;
+ Paint mSelector;
public ActionDrawer(int w, int h) {
mWidth = w;
mHeight = h;
bounds = new RectF(0, 0, 0, 0);
+
+ mButtonPaint = new Paint();
+ mBackgroundPaint = new Paint();
+ mBackgroundPaint.setColor(mContext.getResources().getColor(R.color.sfl_blue_9));
+ mLines = new Paint();
+ mLines.setAntiAlias(true);
+ mLines.setStrokeWidth(2);
+ mLines.setColor(mContext.getResources().getColor(R.color.transparent_grey));
+
+ mSelector = new Paint();
+ mSelector.setStyle(Style.FILL);
+ mSelector.setColor(mContext.getResources().getColor(R.color.sfl_dark_blue));
}
diff --git a/src/org/sflphone/model/BubbleContact.java b/src/org/sflphone/model/BubbleContact.java
index 7e47908..e1b73e6 100644
--- a/src/org/sflphone/model/BubbleContact.java
+++ b/src/org/sflphone/model/BubbleContact.java
@@ -29,13 +29,13 @@
public BubbleContact(Context context, SipCall call, float x, float y, float size) {
super(context, call.getContact(), x, y, size);
associated_call = call;
-
+
buttonMsg = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_chat);
buttonHold = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_pause_over_video);
buttonUnhold = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_play_over_video);
buttonTransfer = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_forward);
buttonHangUp = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_end_call);
-
+
setDrawer(new ActionDrawer(0, 0, drawerPosition.UNDEFINED));
}
@@ -84,18 +84,15 @@
int direction;
RectF boundsHoldButton, boundsMsgButton, boundsTransferButton, boundsHangUpButton;
private String TAG = ActionDrawer.class.getSimpleName();
- Paint mBackgroundPaint;
- Paint mSelector;
- Paint mButtonPaint;
int wHang, hHang;
int wHold, hHold;
int wMsg, hMsg;
int wTrans, hTrans;
- private RectF boundsTransferIcon;
- private RectF boundsMsgIcon;
- private RectF boundsHangIcon;
- private RectF boundsHoldIcon;
+ private RectF boundsTransferIcon,boundsMsgIcon, boundsHangIcon, boundsHoldIcon;
+
+ private int LINE_PADDING = 25;
+
Paint pButtons = new Paint();
@@ -103,16 +100,6 @@
super(w, h);
direction = dir;
- mBackgroundPaint = new Paint();
- mBackgroundPaint.setColor(mContext.getResources().getColor(R.color.sfl_blue_9));
- mBackgroundPaint.setDither(true);
-
- mSelector = new Paint();
- mSelector.setStyle(Style.FILL);
- mSelector.setColor(mContext.getResources().getColor(R.color.sfl_light_blue));
-
- mButtonPaint = new Paint();
-
wHang = buttonHangUp.getWidth();
hHang = buttonHangUp.getHeight();
@@ -165,10 +152,8 @@
public void generateBitmap(int action) {
img = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
- Paint paint = new Paint();
- paint.setColor(mContext.getResources().getColor(R.color.sfl_blue_9));
Canvas c = new Canvas(img);
- c.drawRect(new RectF(0, 0, mWidth, mHeight), paint);
+ c.drawRect(new RectF(0, 0, mWidth, mHeight), mBackgroundPaint);
float rHeight, rWidth;
switch (direction) {
@@ -181,16 +166,26 @@
calculateIconBounds();
draw(c, action);
+
+ c.drawLine(LINE_PADDING, boundsHoldButton.bottom, mWidth - LINE_PADDING, boundsHoldButton.bottom, mLines);
+ c.drawLine(LINE_PADDING, boundsMsgButton.bottom, mWidth - LINE_PADDING, boundsMsgButton.bottom, mLines);
+ c.drawLine(LINE_PADDING, boundsTransferButton.bottom, mWidth - LINE_PADDING, boundsTransferButton.bottom, mLines);
+
break;
case drawerPosition.BOTTOM:
rHeight = bounds.height() - getRadius();
- boundsHoldButton = new RectF(0, 0, mWidth, rHeight / 4);
- boundsMsgButton = new RectF(0, rHeight / 4, mWidth, 2 * rHeight / 4);
- boundsTransferButton = new RectF(0, 2 * rHeight / 4, mWidth, 3 * rHeight / 4);
- boundsHangUpButton = new RectF(0, 3 * rHeight / 4, mWidth, rHeight);
+ boundsHangUpButton = new RectF(0, 0, mWidth, rHeight / 4);
+ boundsTransferButton = new RectF(0, rHeight / 4, mWidth, 2 * rHeight / 4);
+ boundsMsgButton = new RectF(0, 2 * rHeight / 4, mWidth, 3 * rHeight / 4);
+ boundsHoldButton = new RectF(0, 3 * rHeight / 4, mWidth, rHeight);
calculateIconBounds();
draw(c, action);
+
+ c.drawLine(LINE_PADDING, boundsHangUpButton.bottom, mWidth - LINE_PADDING, boundsHangUpButton.bottom, mLines);
+ c.drawLine(LINE_PADDING, boundsTransferButton.bottom, mWidth - LINE_PADDING, boundsTransferButton.bottom, mLines);
+ c.drawLine(LINE_PADDING, boundsMsgButton.bottom, mWidth - LINE_PADDING,boundsMsgButton.bottom, mLines);
+
break;
case drawerPosition.RIGHT:
rWidth = bounds.width() - getRadius();
@@ -201,14 +196,19 @@
calculateIconBounds();
draw(c, action);
+
+ c.drawLine(boundsHoldButton.right, LINE_PADDING, boundsHoldButton.right, mHeight - LINE_PADDING, mLines);
+ c.drawLine(boundsMsgButton.right, LINE_PADDING, boundsMsgButton.right, mHeight - LINE_PADDING, mLines);
+ c.drawLine(boundsTransferButton.right, LINE_PADDING, boundsTransferButton.right, mHeight - LINE_PADDING, mLines);
+
break;
case drawerPosition.LEFT:
rWidth = bounds.width() - getRadius();
- boundsHoldButton = new RectF(getRadius(), 0, getRadius() + rWidth / 4, mHeight);
- boundsMsgButton = new RectF(getRadius() + rWidth / 4, 0, getRadius() + 2 * rWidth / 4, mHeight);
- boundsTransferButton = new RectF(getRadius() + 2 * rWidth / 4, 0, getRadius() + 3 * rWidth / 4, mHeight);
- boundsHangUpButton = new RectF(getRadius() + 3 * rWidth / 4, 0, getRadius() + rWidth, mHeight);
+ boundsHangUpButton = new RectF(getRadius(), 0, getRadius() + rWidth / 4, mHeight);
+ boundsTransferButton = new RectF(getRadius() + rWidth / 4, 0, getRadius() + 2 * rWidth / 4, mHeight);
+ boundsMsgButton = new RectF(getRadius() + 2 * rWidth / 4, 0, getRadius() + 3 * rWidth / 4, mHeight);
+ boundsHoldButton = new RectF(getRadius() + 3 * rWidth / 4, 0, getRadius() + rWidth, mHeight);
calculateIconBounds();
draw(c, action);
@@ -217,14 +217,16 @@
}
+
+
private void draw(Canvas c, int action) {
if (action == actions.HANGUP) {
- c.drawCircle(boundsHangUpButton.centerX(), boundsHangUpButton.centerY(), boundsHangUpButton.width() / 2, mSelector);
+ c.drawRect(boundsHangUpButton, mSelector);
}
c.drawBitmap(buttonHangUp, null, boundsHangIcon, pButtons);
if (action == actions.HOLD) {
- c.drawCircle(boundsHoldButton.centerX(), boundsHoldButton.centerY(), boundsHoldButton.width() / 2, mSelector);
+ c.drawRect(boundsHoldButton, mSelector);
}
if (associated_call.isOnHold()) {
c.drawBitmap(buttonUnhold, null, boundsHoldIcon, pButtons);
@@ -232,12 +234,12 @@
c.drawBitmap(buttonHold, null, boundsHoldIcon, pButtons);
}
if (action == actions.MESSAGE) {
- c.drawCircle(boundsMsgButton.centerX(), boundsMsgButton.centerY(), boundsMsgButton.width() / 2, mSelector);
+ c.drawRect(boundsMsgButton, mSelector);
}
c.drawBitmap(buttonMsg, null, boundsMsgIcon, pButtons);
if (action == actions.TRANSFER) {
- c.drawCircle(boundsTransferButton.centerX(), boundsTransferButton.centerY(), boundsTransferButton.width() / 2, mSelector);
+ c.drawRect(boundsTransferButton, mSelector);
}
c.drawBitmap(buttonTransfer, null, boundsTransferIcon, pButtons);
}
diff --git a/src/org/sflphone/model/BubbleUser.java b/src/org/sflphone/model/BubbleUser.java
index 465d025..e0f3064 100644
--- a/src/org/sflphone/model/BubbleUser.java
+++ b/src/org/sflphone/model/BubbleUser.java
@@ -98,21 +98,16 @@
int wHold, hHold;
int wMic, hMic;
int wRec, hRec;
- Paint mBackgroundPaint;
- Paint mSelector;
- Paint mButtonPaint;
+
+ float delta;
+
+ private RectF globals;
public ActionDrawer(int w, int h) {
super(w, h);
- mBackgroundPaint = new Paint();
- mBackgroundPaint.setColor(mContext.getResources().getColor(R.color.sfl_blue_9));
- mBackgroundPaint.setDither(true);
- mSelector = new Paint();
- mSelector.setStyle(Style.FILL);
- mSelector.setColor(mContext.getResources().getColor(R.color.sfl_blue_9));
-
- mButtonPaint = new Paint();
+ delta = (float) (w / 2 * Math.cos(Math.toRadians(45d)));
+ globals = new RectF(0, 0, mWidth, mHeight);
buttonMic = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_mic);
buttonMicMuted = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_mic_muted);
@@ -145,6 +140,9 @@
drawMute(c, action == actions.MUTE);
drawRec(c, action == actions.RECORD);
+ c.drawLine(mWidth / 2 - delta, mHeight / 2 - delta, mWidth / 2 + delta, mHeight / 2 + delta, mLines);
+ c.drawLine(mWidth / 2 - delta, mHeight / 2 + delta, mWidth / 2 + delta, mHeight / 2 - delta, mLines);
+
}
private void drawHangUp(Canvas c, boolean selected) {
@@ -154,7 +152,7 @@
(int) boundsHangUpButton.centerX() + wHang / 2, (int) boundsHangUpButton.centerY() + hHang / 2);
if (selected) {
- c.drawCircle(boundsHangUpButton.centerX(), boundsHangUpButton.centerY(), boundsHangUpButton.width() / 2, mSelector);
+ c.drawArc(globals, 225, 90, true, mSelector);
}
c.drawBitmap(buttonHangUp, null, boundsHangUpIcon, mButtonPaint);
@@ -165,7 +163,7 @@
RectF boundsHoldIcon = new RectF((int) boundsHoldButton.centerX() - wHold / 2, (int) boundsHoldButton.centerY() - hHold / 2,
(int) boundsHoldButton.centerX() + wHold / 2, (int) boundsHoldButton.centerY() + hHold / 2);
if (selected) {
- c.drawCircle(boundsHoldButton.centerX(), boundsHoldButton.centerY(), boundsHoldButton.width() / 2, mSelector);
+ c.drawArc(globals, 135, 90, true, mSelector);
}
if (associated_call.isOnHold()) {
@@ -179,8 +177,8 @@
boundsMicButton = new RectF(mWidth / 2 + getRadius(), mHeight / 2 - getRadius(), mWidth, mHeight / 2 + getRadius());
RectF boundsMuteIcon = new RectF((int) boundsMicButton.centerX() - wMic / 2, (int) boundsMicButton.centerY() - hMic / 2,
(int) boundsMicButton.centerX() + wMic / 2, (int) boundsMicButton.centerY() + hMic / 2);
- if (selected) {
- c.drawCircle(boundsMicButton.centerX(), boundsMicButton.centerY(), boundsMicButton.width() / 2, mSelector);
+ if (selected || mMuted) {
+ c.drawArc(globals, -45, 90, true, mSelector);
}
c.drawBitmap(buttonMic, null, boundsMuteIcon, mButtonPaint);
@@ -191,7 +189,7 @@
RectF boundsRecIcon = new RectF((int) boundsRecButton.centerX() - wRec / 2, (int) boundsRecButton.centerY() - hRec / 2,
(int) boundsRecButton.centerX() + wRec / 2, (int) boundsRecButton.centerY() + hMic / 2);
if (selected || associated_call.isRecording()) {
- c.drawCircle(boundsRecButton.centerX(), boundsRecButton.centerY(), boundsRecButton.width() / 2, mSelector);
+ c.drawArc(globals, 45, 90, true, mSelector);
}
c.drawBitmap(buttonRec, null, boundsRecIcon, mButtonPaint);