作业风险清单 增加手动添加入口,工作票,辅助工作 增加type字段
parent
ef0c6dc1cb
commit
431774ac49
@ -0,0 +1,149 @@
|
|||||||
|
package com.rehome.zhdcoa.weiget;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.TintTypedArray;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.rehome.zhdcoa.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rehome-rjb1 on 2017/5/8.
|
||||||
|
* 导航栏的封装
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OAToolbarTwo extends Toolbar {
|
||||||
|
|
||||||
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
|
private View view;
|
||||||
|
private TextView tvTitle;
|
||||||
|
private TextView tvRight;
|
||||||
|
|
||||||
|
private TextView tvRightBottom;
|
||||||
|
private ImageButton ivLeft;
|
||||||
|
|
||||||
|
public OAToolbarTwo(Context context) {
|
||||||
|
super(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
|
public OAToolbarTwo(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
initView();
|
||||||
|
setContentInsetsRelative(10, 10);
|
||||||
|
if (attrs != null) {
|
||||||
|
@SuppressLint("RestrictedApi") final TintTypedArray tta = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.OAToolbar);
|
||||||
|
@SuppressLint("RestrictedApi") String title = tta.getString(R.styleable.OAToolbar_tvTitle);
|
||||||
|
@SuppressLint("RestrictedApi") String tvRightText = tta.getString(R.styleable.OAToolbar_tvRight);
|
||||||
|
@SuppressLint("RestrictedApi") Drawable drawable = tta.getDrawable(R.styleable.OAToolbar_ivLeftIcon);
|
||||||
|
|
||||||
|
setIvLeftIcon(drawable);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(title)) {
|
||||||
|
setTvTitleText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(tvRightText)) {
|
||||||
|
setTvRightText(tvRightText);
|
||||||
|
}
|
||||||
|
|
||||||
|
tta.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAToolbarTwo(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
|
||||||
|
inflater = LayoutInflater.from(getContext());
|
||||||
|
|
||||||
|
if (view == null) {
|
||||||
|
view = inflater.inflate(R.layout.toolbartwo, null);
|
||||||
|
tvTitle = view.findViewById(R.id.tv_title);
|
||||||
|
tvRight = view.findViewById(R.id.tv_right);
|
||||||
|
tvRightBottom = view.findViewById(R.id.tv_rightBottom);
|
||||||
|
ivLeft = view.findViewById(R.id.iv_left);
|
||||||
|
//然后使用LayoutParams把控件添加到子view中
|
||||||
|
LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL);
|
||||||
|
addView(view, lp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvTitleText(String text) {
|
||||||
|
if (tvTitle != null) {
|
||||||
|
tvTitle.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvTitleColor(int color) {
|
||||||
|
if (tvTitle != null) {
|
||||||
|
tvTitle.setTextColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvRightText(String text) {
|
||||||
|
if (tvRight != null) {
|
||||||
|
tvRight.setVisibility(VISIBLE);
|
||||||
|
tvRight.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvRightTextBottom(String text) {
|
||||||
|
if (tvRightBottom != null) {
|
||||||
|
tvRightBottom.setVisibility(VISIBLE);
|
||||||
|
tvRightBottom.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvRightText(int text) {
|
||||||
|
if (tvRight != null) {
|
||||||
|
tvRight.setVisibility(VISIBLE);
|
||||||
|
tvRight.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvRightOnClickListener(OnClickListener listener) {
|
||||||
|
tvRight.setOnClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvRightBottomOnClickListener(OnClickListener listener) {
|
||||||
|
tvRightBottom.setOnClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIvLeftIcon(int resId) {
|
||||||
|
if (ivLeft != null) {
|
||||||
|
ivLeft.setVisibility(VISIBLE);
|
||||||
|
ivLeft.setImageResource(resId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIvLeftIcon(Drawable drawable) {
|
||||||
|
if (ivLeft != null) {
|
||||||
|
ivLeft.setVisibility(VISIBLE);
|
||||||
|
ivLeft.setImageDrawable(drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIvLeftOnClickListener(OnClickListener listener) {
|
||||||
|
ivLeft.setOnClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".ui.activity.WorkTickerAssistantSelectListActivity">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbarView"
|
||||||
|
layout="@layout/layout_base" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#dddddd"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:minHeight="30px">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_zxsj"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5px"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="50px"
|
||||||
|
android:text="作业风险清单日期:"
|
||||||
|
android:textSize="24px" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_st"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="50px"
|
||||||
|
android:textColor="@color/colorPrimaryDark"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="24px" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/item_head"
|
||||||
|
layout="@layout/header_work_ticket_select_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginStart="10px"
|
||||||
|
android:layout_marginEnd="10px"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10px"
|
||||||
|
android:layout_marginEnd="10px"
|
||||||
|
android:layout_marginBottom="10px"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/lv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:divider="#00000000"
|
||||||
|
android:dividerHeight="0px"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_nodata"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textColor="@color/viewfinder_mask"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="暂无数据"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_submit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="提交"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/top_ll"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.rehome.zhdcoa.weiget.OAToolbarTwo
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100px"
|
||||||
|
android:background="@color/colorPrimaryDark" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/iv_left"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:background="#00ffffff"
|
||||||
|
android:contentDescription="back_btn_my_mt"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="125dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_right"
|
||||||
|
android:layout_width="125dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|end"
|
||||||
|
android:text="工作票"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_rightBottom"
|
||||||
|
android:layout_width="125dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:gravity="center|end"
|
||||||
|
android:text="辅助工作票"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
Loading…
Reference in New Issue