Created rounded corner view and shadow for tour selection view

This commit is contained in:
Denis 2014-08-13 13:16:30 +03:00
parent 586c030cca
commit c821913f3d
4 changed files with 140 additions and 63 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<stroke android:width="1dip" android:color="@color/sherpafy_add_text" />
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -12,20 +12,22 @@
android:layout_marginRight="14dp"
android:layout_marginTop="15dp"
android:id="@+id/AreaPreview"
android:background="@color/color_white"
android:background="@drawable/tour_bg"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/shadow_color" >
android:layout_height="wrap_content">
<ImageView
<net.osmand.plus.views.CustomImageView
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="1dp"
android:id="@+id/TourImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:scaleType="centerCrop">
</ImageView>
</net.osmand.plus.views.CustomImageView>
<TextView
android:id="@+id/TourName"
@ -33,6 +35,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="10dp"
android:layout_marginRight="6dp"
android:background="@color/shadow_color"
android:ellipsize="end"
android:maxLines="1"
@ -69,6 +72,8 @@
android:focusable="false"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/header_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:textSize="18sp"/>
<ImageButton android:id="@+id/all_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="gone"
style="@style/Widget.Sherlock.ActionButton"
android:src="@drawable/ic_action_core_overflow_dark"/>
</LinearLayout>

View file

@ -0,0 +1,38 @@
package net.osmand.plus.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by Denis on 13.08.2014.
*/
public class CustomImageView extends ImageView {
public static float radius = 13.0f;
public CustomImageView(Context context) {
super(context);
}
public CustomImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
//float radius = 36.0f;
Path clipPath = new Path();
RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(clipPath);
super.onDraw(canvas);
}
}