package com.bn.lc;
import static com.bn.lc.Constant.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ListView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
public class CalActivity extends Activity{
CalActivity calactivity;
static int last;//返回的页面
//获取当前日期
Calendar c=Calendar.getInstance();
int year=c.get(Calendar.YEAR);
int month=c.get(Calendar.MONTH)+1;
int day=c.get(Calendar.DAY_OF_MONTH);
String curdate=year+"-"+month+"-"+day;
String curdate2=year+"年"+month+"月";
final int List_DIALOG1=1;//贷款类型列表对话框的数组
final int List_DIALOG2=2;//年列表对话框的数组
final int List_DIALOG3=3;//月列表对话框的数组
final int List_DIALOG4=4;//商业贷款利率列表对话框的数组
final int List_DIALOG5=5;//还款方式1
final int List_DIALOG6=6;//公积金贷款利率列表对话框的数组
final int List_DIALOG7=7;//公积金还款方式2
final int List_DIALOG8=8;//还款方式3
final int List_DIALOG9=9;//原贷款类型
final int List_DIALOG10=10;//原贷款方式列表对话框的数组
// final int List_DIALOG11=11;//还款方式列表对话框的数组
final int List_DIALOG12=12;//整存整取储蓄存期列表对话框
final int List_DIALOG13=13;//储蓄存期2
final int List_DIALOG14=14;//支取频度
final int Date_DIALOG1=15;//第一次还款时间
final int Date_DIALOG2=16;//预计提前还款时间
final int Date_DIALOG3=17;//存入日期
final int Date_DIALOG4=18;//提取日期
private NumberDialog num1;
private NumberDialog num2;
private NumberDialog num3;
private NumberDialog num4;
Date inputdate;//存入日期
double inputmoney=0;//存入金额,每月存入金额
double yearrate;//年利率
Date outputdate;//提取日期
double durdate;//储蓄存期
Date startdate;//初始存入日期
double yuerate=0;//月利率
double pindu=1;//支取频度
double times;//支取次数
double dnian;//贷款期限年数
double dyue;//贷款期限月数
int hkfs;
List<String[]> detailList=new ArrayList<String[]>();
List<Double> tqList=new ArrayList<Double>();
double businessinputmoney;
double businessyearrate;
double businessdurdate;
double jijininputmoney;
double jijinyearrate;
double jijindurdate;
private int hkyear;
private int hkmonth;
private int tqhkyear;
private int tqhkmonth;
private int timeinterval;
public boolean onKeyDown(int keyCode, KeyEvent event) {
//按下手机返回按钮时
if(keyCode==4){
goBack(last);
return true;
}
return false;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags
(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//强制竖屏
goCal();
}
public void goBack(int last)
{
switch(last)
{
case P_MAIN:
CalActivity.this.finish();
break;
case P_JISUAN:
goCal();
break;
case P_FD_GJJ:
goJiJinfangdai();
break;
case P_FD_SYDK:
goBusinessFangdai();
break;
case P_FD_ZHX:
goZHfangdai();
break;
case P_TQHK_SYDK:
goHuankuan();
break;
case P_TQHU_GJJ:
goHuankuan();
break;
case P_HQCX:
goSubHuoqi();
break;
case P_LCZQ:
goSubLingCunZhengQu();
break;
case P_ZCZQ:
goSubZhengCunZhengQu();
break;
case P_ZCLQ:
goSubZhengCunLingQu();
break;
}
}
public void goCal()
{
last=P_MAIN;
setContentView(R.layout.cal1);
Button fangdai=(Button)findViewById(R.id.fd);
Button huankuan=(Button)findViewById(R.id.tqhk);
Button huoqi=(Button)findViewById(R.id.hqcx);
Button lczq=(Button)findViewById(R.id.lczq);
Button zczq=(Button)findViewById(R.id.zczq);
Button zclq=(Button)findViewById(R.id.zclq);
fangdai.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goBusinessFangdai();
}
}
);
huankuan.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goHuankuan();
}
}
);
huoqi.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goSubHuoqi();
}
}
);
lczq.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goSubLingCunZhengQu();
}
}
);
zczq.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goSubZhengCunZhengQu();
}
}
);
zclq.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("zhu", "go qian");
goSubZhengCunLingQu();
Log.d("zhu", "go hou");
}
}
);
}
//房贷
public void goBusinessFangdai()
{
last=P_JISUAN;
setContentView(R.layout.businessfangdai);
Log.d("fangdai jianting", "jin ru fang dai!");
num1=new NumberDialog(CalActivity.this);
num2=new NumberDialog(CalActivity.this);
Button back=(Button)findViewById(R.id.back);
Button cal=(Button)findViewById(R.id.jscal);
Button daikuan=(Button)findViewById(R.id.strB);
Button jine=(Button)findViewById(R.id.jine);
Button nian=(Button)findViewById(R.id.nian);
Button yue=(Button)findViewById(R.id.yue);
Button input=(Button)findViewById(R.id.shuru);
Button lilv=(Button)findViewById(R.id.lilv);
Button hkmode=(Button)findViewById(R.id.hkmode1);
hkfs=1;
back.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
goCal();
}
}
);
daikuan.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(List_DIALOG1);
}
}
);
nian.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(List_DIALOG2);
}
}
);
yue.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(List_DIALOG3);
}
}
);
input.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(List_DIALOG4);
}
}
);
hkmode.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(List_DIALOG5);
}
}
);
jine.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
//弹出数字键盘
num1.show();
}
}
);
lilv.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
//弹出数字键盘
- 1
- 2
前往页