结队项目4
package com.pwp.activity;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.AlertDialog.Builder;
import android.app.DatePickerDialog.OnDateSetListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.DatePicker;
import android.widget.TextView;
import com.pwp.borderText.BorderTextView;
import com.pwp.calendar.LunarCalendar;
public class CalendarConvert extends Activity {
private LunarCalendar lc = null;
private BorderTextView convertDate = null;
private BorderTextView convertBT = null;
private TextView lunarDate = null;
private int year_c;
private int month_c;
private int day_c;
public CalendarConvert() {
this.lc = new LunarCalendar();
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(2130903041);
this.convertDate = (BorderTextView)this.findViewById(2131099650);
this.convertBT = (BorderTextView)this.findViewById(2131099651);
this.lunarDate = (TextView)this.findViewById(2131099652);
Intent intent = this.getIntent();
int[] date = intent.getIntArrayExtra("date");
this.year_c = date[0];
this.month_c = date[1];
this.day_c = date[2];
this.convertDate.setText(this.year_c + "年" + this.month_c + "月" + this.day_c);
this.convertDate.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
(new DatePickerDialog(CalendarConvert.this, new OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
if(year >= 1901 && year <= 2049) {
CalendarConvert.this.year_c = year;
CalendarConvert.this.month_c = monthOfYear + 1;
CalendarConvert.this.day_c = dayOfMonth;
CalendarConvert.this.convertDate.setText(CalendarConvert.this.year_c + "年" + CalendarConvert.this.month_c + "月" + CalendarConvert.this.day_c);
} else {
(new Builder(CalendarConvert.this)).setTitle("错误日期").setMessage("跳转日期范围(1901/1/1-2049/12/31)").setPositiveButton("确认", (android.content.DialogInterface.OnClickListener)null).show();
}
}
}, CalendarConvert.this.year_c, CalendarConvert.this.month_c - 1, CalendarConvert.this.day_c)).show();
}
});
this.convertBT.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String lunarDay = CalendarConvert.this.getLunarDay(CalendarConvert.this.year_c, CalendarConvert.this.month_c, CalendarConvert.this.day_c);
String lunarYear = String.valueOf(CalendarConvert.this.lc.getYear());
String lunarMonth = CalendarConvert.this.lc.getLunarMonth();
CalendarConvert.this.lunarDate.setText(lunarYear + "年" + lunarMonth + lunarDay);
}
});
}
public String getLunarDay(int year, int month, int day) {
String lunarDay = this.lc.getLunarDate(year, month, day, true);
if(lunarDay.substring(1, 2).equals("月")) {
lunarDay = "初一";
}
return lunarDay;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.pwp.activity;
public final class R {
public R() {
}
public static final class anim {
public static final int push_left_in = 2130968576;
public static final int push_left_out = 2130968577;
public static final int push_right_in = 2130968578;
public static final int push_right_out = 2130968579;
public anim() {
}
}
public static final class attr {
public attr() {
}
}
public static final class drawable {
public static final int add = 2130837504;
public static final int calendar = 2130837505;
public static final int current_day_bgc = 2130837506;
public static final int date_convert = 2130837507;
public static final int gridview_bk = 2130837508;
public static final int icon = 2130837509;
public static final int item = 2130837510;
public static final int list_item_selected_bg = 2130837511;
public static final int mark = 2130837512;
public static final int next_year = 2130837513;
public static final int notebook = 2130837514;
public static final int previous_year = 2130837515;
public static final int schedule_bk = 2130837516;
public static final int schedule_type = 2130837517;
public static final int top = 2130837518;
public static final int top_day = 2130837519;
public static final int week_top = 2130837520;
public drawable() {
}
}
public static final class id {
public static final int convert = 2131099651;
public static final int convertDate = 2131099650;
public static final int convertResult = 2131099652;
public static final int convertTop = 2131099649;
public static final int flipper = 2131099654;
public static final int save = 2131099659;
public static final int scheduleDate = 2131099657;
public static final int scheduleInfo = 2131099661;
public static final int scheduleInfoTop = 2131099660;
public static final int scheduleText = 2131099658;
public static final int scheduleTop = 2131099655;
public static final int scheduleType = 2131099656;
public static final int toptext = 2131099653;
public static final int tvtext = 2131099648;
public id() {
}
}
public static final class layout {
public static final int calendar = 2130903040;
public static final int convert = 2130903041;
public static final int main = 2130903042;
public static final int schedule = 2130903043;
public static final int schedule_info = 2130903044;
public layout() {
}
}
public static final class string {
public static final int app_name = 2131034113;
public static final int hello = 2131034112;
public string() {
}
}
}