Skip to content
Snippets Groups Projects
Commit 21b4bedc authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #33930: v3 design integrated

parent 721130dd
No related branches found
No related tags found
No related merge requests found
...@@ -2,14 +2,10 @@ ...@@ -2,14 +2,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_pressed="true"><shape android:shape="oval"> <item android:state_enabled="true" android:state_pressed="true"><shape android:shape="oval">
<solid android:color="@color/sfl_dark_blue" /> <solid android:color="@color/sfl_light_blue" />
<stroke android:width="3dp" android:color="@color/sfl_action_blue" />
</shape></item> </shape></item>
<item><shape android:shape="oval"> <item><shape android:shape="oval">
<solid android:color="@color/sfl_light_blue" /> <solid android:color="@color/sfl_dark_blue" />
<stroke android:width="3dp" android:color="@color/sfl_action_blue" />
</shape></item> </shape></item>
</selector> </selector>
\ No newline at end of file
...@@ -5,22 +5,16 @@ ...@@ -5,22 +5,16 @@
<solid android:color="@color/sfl_light_blue" /> <solid android:color="@color/sfl_light_blue" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /> <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item> </shape></item>
<item android:state_focused="true"><shape xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true"><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/sfl_light_blue" /> <solid android:color="@color/sfl_light_blue" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /> <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item> </shape></item>
<item><shape xmlns:android="http://schemas.android.com/apk/res/android"> <item><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/sfl_light_blue" /> <solid android:color="@color/sfl_light_blue" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /> <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item> </shape></item>
</selector> </selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/sfl_light_blue" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape></item>
<item android:state_focused="true"><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/sfl_light_blue" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape></item>
<item><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/sfl_blue_0" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape></item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content"
android:background="@drawable/dialer_selector" >
<EditText <EditText
android:id="@+id/clearable_edit" android:id="@+id/clearable_edit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#00000000"
android:hint="@string/dial_hint" android:hint="@string/dial_hint"
android:imeActionLabel="@string/dial_action_call" android:imeActionLabel="@string/dial_action_call"
android:imeOptions="actionGo" android:imeOptions="actionGo"
...@@ -18,9 +20,18 @@ ...@@ -18,9 +20,18 @@
android:id="@+id/clearable_button_clear" android:id="@+id/clearable_button_clear"
android:layout_width="30dip" android:layout_width="30dip"
android:layout_height="30dip" android:layout_height="30dip"
android:layout_alignBaseline="@+id/clearable_edit"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dip" android:layout_marginRight="5dip"
android:background="@drawable/ic_action_remove" /> android:background="@drawable/ic_action_remove" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/clearable_edit"
android:layout_marginTop="10dp"
android:background="@color/darker_gray" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="9dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:background="@color/lighter_gray" android:background="@color/lighter_gray"
android:padding="5dp" > android:padding="5dp" >
...@@ -10,49 +12,62 @@ ...@@ -10,49 +12,62 @@
android:id="@+id/textField" android:id="@+id/textField"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true" />
android:background="@drawable/dialer_selector" />
<LinearLayout <RelativeLayout
android:id="@+id/keyboard_choice" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textField" android:layout_alignLeft="@+id/textField"
android:layout_alignRight="@+id/textField" android:layout_alignRight="@+id/textField"
android:layout_below="@+id/textField" android:layout_below="@+id/textField" >
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:weightSum="2" >
<ImageButton <ImageView
android:id="@+id/numeric_keyboard" android:id="@+id/fake_padding"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="30dp"
android:layout_weight="1" android:background="@color/sfl_light_blue" />
android:background="@drawable/item_generic_selector"
android:contentDescription="@string/dial_numeric_pad" <LinearLayout
android:layout_marginRight="5dp" android:id="@+id/keyboard_choice"
android:src="@drawable/ic_action_dial_pad" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/fake_padding"
android:layout_marginBottom="15dp"
android:weightSum="100" >
<ImageButton
android:id="@+id/numeric_keyboard"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="30"
android:background="@drawable/item_keyboard_choice_selector"
android:contentDescription="@string/dial_numeric_pad"
android:src="@drawable/ic_action_dial_pad_light" />
<org.sflphone.views.CircularImageView
android:id="@+id/fake_dar_band"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="40"
android:background="@drawable/item_keyboard_choice_selector" />
<ImageButton
android:id="@+id/alphabetic_keyboard"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="30"
android:background="@drawable/item_keyboard_choice_selector"
android:contentDescription="@string/dial_alphabetic_pad"
android:src="@drawable/ic_action_keyboard_light" />
</LinearLayout>
<ImageButton <ImageButton
android:id="@+id/alphabetic_keyboard" android:id="@+id/buttonCall"
android:layout_width="0dp" android:layout_width="100dp"
android:layout_height="match_parent" android:layout_height="100dp"
android:layout_weight="1" android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp" android:background="@drawable/call_button"
android:background="@drawable/item_generic_selector" android:src="@drawable/ic_action_call" />
android:contentDescription="@string/dial_alphabetic_pad" </RelativeLayout>
android:src="@drawable/ic_action_keyboard" />
</LinearLayout>
<ImageButton
android:id="@+id/buttonCall"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@+id/keyboard_choice"
android:layout_centerHorizontal="true"
android:background="@drawable/call_button"
android:gravity="center_vertical"
android:src="@drawable/ic_action_call" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
package org.sflphone.views;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class CircularImageView extends ImageView
{
private int borderWidth = 4;
private int viewWidth;
private int viewHeight;
private Bitmap image;
private Paint paint;
private Paint paintBorder;
private BitmapShader shader;
public CircularImageView(Context context)
{
super(context);
setup();
}
public CircularImageView(Context context, AttributeSet attrs)
{
super(context, attrs);
setup();
}
public CircularImageView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
setup();
}
private void setup()
{
// init paint
paint = new Paint();
paint.setAntiAlias(true);
paintBorder = new Paint();
setBorderColor(Color.WHITE);
paintBorder.setAntiAlias(true);
this.setLayerType(LAYER_TYPE_SOFTWARE, paintBorder);
paintBorder.setShadowLayer(4.0f, 0.0f, 2.0f, Color.BLACK);
}
public void setBorderWidth(int borderWidth)
{
this.borderWidth = borderWidth;
this.invalidate();
}
public void setBorderColor(int borderColor)
{
if (paintBorder != null)
paintBorder.setColor(borderColor);
this.invalidate();
}
private void loadBitmap()
{
BitmapDrawable bitmapDrawable = (BitmapDrawable) this.getDrawable();
if (bitmapDrawable != null)
image = bitmapDrawable.getBitmap();
}
@SuppressLint("DrawAllocation")
@Override
public void onDraw(Canvas canvas)
{
// load the bitmap
loadBitmap();
// init shader
if (image != null)
{
shader = new BitmapShader(Bitmap.createScaledBitmap(image, canvas.getWidth(), canvas.getHeight(), false), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
paint.setShader(shader);
int circleCenter = viewWidth / 2;
// circleCenter is the x or y of the view's center
// radius is the radius in pixels of the cirle to be drawn
// paint contains the shader that will texture the shape
canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter + borderWidth - 4.0f, paintBorder);
canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter - 4.0f, paint);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
int width = measureWidth(widthMeasureSpec);
int height = measureHeight(heightMeasureSpec, widthMeasureSpec);
viewWidth = width - (borderWidth * 2);
viewHeight = height - (borderWidth * 2);
setMeasuredDimension(width, height);
}
private int measureWidth(int measureSpec)
{
int result = 0;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY)
{
// We were told how big to be
result = specSize;
}
else
{
// Measure the text
result = viewWidth;
}
return result;
}
private int measureHeight(int measureSpecHeight, int measureSpecWidth)
{
int result = 0;
int specMode = MeasureSpec.getMode(measureSpecHeight);
int specSize = MeasureSpec.getSize(measureSpecHeight);
if (specMode == MeasureSpec.EXACTLY)
{
// We were told how big to be
result = specSize;
}
else
{
// Measure the text (beware: ascent is a negative number)
result = viewHeight;
}
return (result + 2);
}
}
\ No newline at end of file
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