app/src/main/java/safeluck/drive/evaluation/customview/ArrowView.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/util/Utils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_net_train.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_net_train_item.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_train_exit.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_train_fragment.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/profile_layout.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/values/colors.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/safeluck/drive/evaluation/customview/ArrowView.java
New file @@ -0,0 +1,74 @@ package safeluck.drive.evaluation.customview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.support.annotation.Nullable; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.util.AttributeSet; import android.view.View; import safeluck.drive.evaluation.util.Utils; /** * MyApplication2 * Created by lzw on 2019/3/18. 11:18:47 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class ArrowView extends View { private Path path = new Path(); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private float PADDING = Utils.px2dp(40); private double a = Math.toRadians(55.0); private int color = Color.parseColor("#99C3D1"); private String text = "直角转弯"; private Path textPath = new Path(); public ArrowView(Context context) { super(context); } public ArrowView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public ArrowView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); path.moveTo(getWidth()/2-PADDING,getHeight()/2-PADDING); path.rLineTo(PADDING,0); path.rLineTo(PADDING*(float)Math.cos(a),PADDING*(float)Math.sin(a)); path.rLineTo(-PADDING*(float)Math.cos(a),PADDING*(float)Math.sin(a)); path.rLineTo(-(PADDING),0); path.rLineTo(PADDING*(float)Math.cos(a),-PADDING*(float)Math.sin(a)); path.rLineTo(-PADDING*(float)Math.cos(a),-PADDING*(float)Math.sin(a)); path.close(); paint.setColor(color); canvas.drawPath(path,paint); paint.setColor(Color.parseColor("#1412f6")); char[] index = getKeyChar(text); Paint.FontMetrics fm = paint.getFontMetrics(); float childHeight = PADDING/text.length(); for (int i = 0; i < text.length(); i++) { canvas.drawText(String.valueOf(index[i]),getWidth()/2-PADDING/3, (float) (((i + 0.5) * childHeight) - (fm.ascent + fm.descent) / 2)+PADDING/3, paint); } } protected char[] getKeyChar(String str) { char[] keys = new char[str.length()]; for (int i = 0; i < keys.length; i++) { keys[i] = str.charAt(i); } return keys; } } app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java
New file @@ -0,0 +1,74 @@ package safeluck.drive.evaluation.customview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; import safeluck.drive.evaluation.util.Utils; /** * MyApplication2 * Created by lzw on 2019/3/18. 11:18:57 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class HouseView extends View { private Path path = new Path(); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private float PADDING = Utils.px2dp(40); private double a = Math.toRadians(55.0); private int color = Color.parseColor("#99C3D1"); private String text = "倒车入库"; public HouseView(Context context) { super(context); } public HouseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public HouseView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); path.moveTo(getWidth()/2-PADDING,getHeight()/2-PADDING); path.rLineTo(PADDING,0); path.rLineTo(PADDING*(float)Math.cos(a),PADDING*(float)Math.sin(a)); path.rLineTo(-PADDING*(float)Math.cos(a),PADDING*(float)Math.sin(a)); path.rLineTo(-(PADDING),0); path.rLineTo(0,PADDING); path.close(); paint.setColor(color); canvas.drawPath(path,paint); paint.setColor(Color.parseColor("#1412f6")); char[] index = getKeyChar(text); Paint.FontMetrics fm = paint.getFontMetrics(); float childHeight = PADDING/text.length(); for (int i = 0; i < text.length(); i++) { canvas.drawText(String.valueOf(index[i]),getWidth()/2-PADDING/3, (float) (((i + 0.5) * childHeight) - (fm.ascent + fm.descent) / 2)+PADDING/3, paint); } } protected char[] getKeyChar(String str) { char[] keys = new char[str.length()]; for (int i = 0; i < keys.length; i++) { keys[i] = str.charAt(i); } return keys; } } app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java
@@ -57,6 +57,13 @@ } break; case R.id.network_train: NetWorkTrainFragment netWorkTrainFragment = findFragment(NetWorkTrainFragment.class); if (netWorkTrainFragment == null){ netWorkTrainFragment = (NetWorkTrainFragment)NetWorkTrainFragment.newInstance(); start(netWorkTrainFragment); }else{ start(netWorkTrainFragment); } //联网考试 break; case R.id.exit_sys: app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java
New file @@ -0,0 +1,30 @@ package safeluck.drive.evaluation.fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import me.yokeyword.fragmentation.SupportFragment; import safeluck.drive.evaluation.R; /** * MyApplication2 * Created by lzw on 2019/3/18. 13:33:14 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class NetWorkTrainFragment extends SupportFragment { public static SupportFragment newInstance() { return new NetWorkTrainFragment(); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_net_train,container,false); return view; } } app/src/main/java/safeluck/drive/evaluation/util/Utils.java
New file @@ -0,0 +1,16 @@ package safeluck.drive.evaluation.util; import android.content.res.Resources; import android.util.TypedValue; /** * MyApplication2 * Created by lzw on 2019/3/18. 13:13:42 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class Utils { public static float px2dp(float value){ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,value, Resources.getSystem().getDisplayMetrics()); } } app/src/main/res/layout/layout_net_train.xml
New file @@ -0,0 +1,49 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" android:gravity="center" android:orientation="vertical" android:background="@color/train_bg" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_item" android:background="@color/train_item_bg" android:padding="10dp" android:text="项目列表"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_toRightOf="@+id/tv_item" android:gravity="center" android:padding="10dp" android:id="@+id/tv_speed" android:text="车速:"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/tv_speed" android:id="@+id/tv_pos" android:padding="10dp" android:gravity="center" android:text="已行驶:45km"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="呼叫请求" android:textColor="@android:color/white" android:padding="10dp" android:layout_marginBottom="2dp" android:background="@color/colorAccent" android:layout_toRightOf="@+id/tv_pos"/> </RelativeLayout> <include layout="@layout/layout_net_train_item"/> </LinearLayout> app/src/main/res/layout/layout_net_train_item.xml
New file @@ -0,0 +1,44 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:background="@color/train_item_bg" android:gravity="bottom"> <safeluck.drive.evaluation.customview.HouseView android:layout_width="80dp" android:layout_height="80dp" android:id="@+id/hv" /> <safeluck.drive.evaluation.customview.ArrowView android:layout_width="80dp" android:layout_height="80dp" android:layout_toRightOf="@+id/hv" android:id="@+id/av1" android:layout_marginLeft="-15dp" /> <safeluck.drive.evaluation.customview.ArrowView android:layout_width="80dp" android:layout_height="80dp" android:layout_marginLeft="-15dp" android:layout_toRightOf="@+id/av1" android:id="@+id/av2" /> <safeluck.drive.evaluation.customview.ArrowView android:layout_width="80dp" android:layout_height="80dp" android:id="@+id/av3" android:layout_marginLeft="-15dp" android:layout_toRightOf="@id/av2" /> <safeluck.drive.evaluation.customview.ArrowView android:layout_width="80dp" android:layout_height="80dp" android:layout_marginLeft="-15dp" android:layout_toRightOf="@+id/av3" android:id="@+id/av4" /> </RelativeLayout> app/src/main/res/layout/layout_train_exit.xml
New file @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout> app/src/main/res/layout/layout_train_fragment.xml
@@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:background="@color/home_bg_color"> <include android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/profile" layout="@layout/profile_layout"/> <include android:layout_marginTop="10dp" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/profile" layout="@layout/profile_layout"/> <include android:layout_weight="1" android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/profile" layout="@layout/profile_layout"/> <include android:layout_marginBottom="10dp" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/profile" layout="@layout/profile_layout"/> <include android:layout_marginBottom="10dp" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/profile" layout="@layout/profile_layout"/> <include android:layout_marginBottom="10dp" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/profile" layout="@layout/layout_net_train"/> </LinearLayout> app/src/main/res/layout/profile_layout.xml
@@ -1,137 +1,156 @@ <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="120dp" xmlns:app="http://schemas.android.com/apk/res-auto" app:cardElevation="10dp" app:cardBackgroundColor="@color/colorAccent" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:background="@color/colorAccent" android:gravity="center" android:orientation="horizontal" android:padding="10dp"> <ImageView android:layout_weight="1" android:layout_width="40dp" android:id="@+id/iv_head" android:layout_width="0dp" android:layout_height="70dp" android:id="@+id/iv_head"/> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_weight="0.5" android:scaleType="fitXY" </RelativeLayout> android:src="@drawable/header" /> <LinearLayout android:layout_width="wrap_content" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_weight="3.5" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" > <TextView android:id="@+id/tv_name" android:text="姓名:lizanwei" android:textColor="@color/colorPrimary" android:layout_toRightOf="@+id/iv_head"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="性别:男" android:layout_toRightOf="@+id/iv_head" android:layout_weight="1" android:text="姓名:lizanwei" android:textColor="@color/colorPrimary" /> <TextView android:id="@+id/tv_sex" android:layout_toRightOf="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_toRightOf="@+id/tv_name" android:layout_weight="1" android:text="性别:男" android:textColor="@color/colorPrimary"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="电子教练:高级" android:layout_weight="1" android:layout_toRightOf="@+id/tv_sex" android:layout_weight="1" android:text="电子教练:高级" android:textColor="@color/colorPrimary"/> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" ></LinearLayout> android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/user_id" android:layout_below="@+id/tv_name" android:id="@+id/tv_ID" android:textColor="@color/colorPrimary" android:layout_toRightOf="@+id/iv_head"/> <TextView android:layout_width="wrap_content" android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/tv_start_time" android:text="开始时间:" android:layout_below="@+id/tv_ID" android:textColor="@color/colorPrimary" android:layout_toRightOf="@+id/iv_head"/> android:layout_below="@+id/tv_name" android:layout_weight="1" android:text="@string/user_id" android:textColor="@color/colorPrimary" /> <TextView android:layout_width="wrap_content" android:id="@+id/inspect" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/inspector" android:layout_toRightOf="@+id/tv_ID" android:layout_below="@+id/tv_name" android:id="@+id/inspect" android:textColor="@color/colorPrimary"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用时:" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:id="@+id/tv_use_time" android:layout_toRightOf="@+id/tv_ID" android:layout_below="@+id/inspect" android:textColor="@color/colorPrimary"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="查看地图" android:layout_toRightOf="@+id/tv_use_time" android:layout_below="@+id/inspect" android:id="@+id/view_map" android:textColor="@color/colorPrimary"/> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="120dp" android:padding="5dp" android:layout_alignParentEnd="true" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="0dp" > <TextView android:id="@+id/tv_start_time" android:layout_width="0dp" android:layout_height="wrap_content" android:text="开始时间:" android:layout_weight="1" android:textColor="@color/colorPrimary" /> <TextView android:id="@+id/tv_use_time" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="用时:" android:textColor="@color/colorPrimary" /> <TextView android:id="@+id/view_map" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="查看地图" android:textColor="@color/colorPrimary" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="center" android:orientation="vertical" android:layout_toRightOf="@+id/view_map"> > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="0dp" android:layout_weight="1" android:src="@drawable/wheel"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="100" android:background="@android:color/holo_green_dark" android:padding="8dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="当前得分" android:layout_height="0dp" android:layout_weight="1" /> android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:background="@android:color/holo_green_dark" android:padding="5dp" android:text="100" /> <TextView android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" android:text="当前得分" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView> app/src/main/res/values/colors.xml
@@ -7,4 +7,6 @@ <color name="home_bg_color">#137b98</color> <color name="home_version_show">#b47242</color> <color name="train_item_bg">#6a75be</color> <color name="train_bg">#4aabb2</color> </resources>