33
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package cn.shangyu.gdxzExpert.activity;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.gzuliyujiang.wheelpicker.DatePicker;
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode;
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener;
|
||||
import com.github.gzuliyujiang.wheelpicker.entity.DateEntity;
|
||||
import com.github.gzuliyujiang.wheelpicker.widget.DateWheelLayout;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.base.BaseActivity;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.widget.LoadingPage;
|
||||
|
||||
public class TerminationDetailActivity extends BaseActivity {
|
||||
|
||||
|
||||
@Override
|
||||
public void setTitle() {
|
||||
|
||||
}
|
||||
LinearLayout l_name;
|
||||
String name;
|
||||
TextView tv_bir;
|
||||
@Override
|
||||
public View onCreateSuccessedView() {
|
||||
View view= UIUtils.inflate(R.layout.activity_termination_detail);
|
||||
l_name=view.findViewById(R.id.l_name);
|
||||
name=getIntent().getStringExtra("name");
|
||||
top_title.setText(name);
|
||||
if("其他恶性肿瘤".equals(name))
|
||||
{
|
||||
l_name.setVisibility(View.VISIBLE);
|
||||
}
|
||||
tv_bir=view.findViewById(R.id.tv_bir);
|
||||
tv_bir.setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onYearMonth(View view) {
|
||||
DatePicker picker = new DatePicker(this);
|
||||
picker.setBodyWidth(240);
|
||||
DateWheelLayout wheelLayout = picker.getWheelLayout();
|
||||
wheelLayout.setRange(DateEntity.target(1900, 1, 1), DateEntity.today(), DateEntity.today());
|
||||
wheelLayout.setDateMode(DateMode.YEAR_MONTH);
|
||||
wheelLayout.setDateLabel("年", "月", "");
|
||||
picker.setOnDatePickedListener(new OnDatePickedListener() {
|
||||
@Override
|
||||
public void onDatePicked(int year, int month, int day) {
|
||||
double y=0,m=0;
|
||||
if(month>DateEntity.today().getMonth())
|
||||
{
|
||||
y=DateEntity.today().getYear()-year-1;
|
||||
m=(12-(month-DateEntity.today().getMonth()))/12.00;
|
||||
}
|
||||
else
|
||||
{
|
||||
y=DateEntity.today().getYear()-year;
|
||||
m=(DateEntity.today().getMonth()-month)/12.00;
|
||||
}
|
||||
|
||||
tv_bir.setText(year+"-"+month+"("+String.format("%.2f", y+m)+"年"+")");
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
@Override
|
||||
public LoadingPage.ResultState onLoad() {
|
||||
return LoadingPage.ResultState.STATE_SUCCESSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processClick(View v) {
|
||||
switch (v.getId())
|
||||
{
|
||||
case R.id.tv_bir:
|
||||
onYearMonth(v);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user