<file_sep>package com.example.tinylove.Database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDataBaseHelper extends SQLiteOpenHelper{

	public MyDataBaseHelper(Context context, String name, int version) {
		super(context, name, null, version);
		// TODO Auto-generated constructor stub
		System.out.println("Create Database!");
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(TinyUser.CREATE_TABLE_TINYUSER);
		db.execSQL(TinyAnni.CREATE_TABLE_TINYANNI);
		db.execSQL(TinyWish.CREATE_TABLE_TINYWISH);
		db.execSQL(TinyCheck.CREATE_TABLE_TINYCHECK);
		db.execSQL(TinyTimePicture.CREATE_TABLE_TINYTIME);
		System.out.println("Create Table!");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		System.out.println("onUpdate Called!    "+oldVersion+"->"+newVersion);
	}
	
}
<file_sep>package com.example.tinylove.Activity;

import java.util.Date;

import com.example.tinylove.R;
import com.example.tinylove.Database.MyDataBaseHelper;
import com.example.tinylove.Database.TinyAnni;
import com.example.tinylove.Database.TinyUser;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

public class SplashActivity extends Activity {
	
	public static MyDataBaseHelper dbHelper;
	
	// ÑÓ³Ù3Ãë
	private static final long SPLASH_DELAY_MILLIS = 1000;
	
	private Handler mHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case 1000:
				Intent intent1 = new Intent(SplashActivity.this, MainActivity.class);
				SplashActivity.this.startActivity(intent1);
				SplashActivity.this.finish();
				break;
			case 1001:
				Intent intent2 = new Intent(SplashActivity.this, GuideActivity.class);
				SplashActivity.this.startActivity(intent2);
				SplashActivity.this.finish();
				break;
			}
			super.handleMessage(msg);
		}
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		 
		SharedPreferences sharedPreferences = this.getSharedPreferences("share", MODE_PRIVATE); 
		boolean isFirstRun = sharedPreferences.getBoolean("isFirstRun", true); 
		Editor editor = sharedPreferences.edit(); 
		if (isFirstRun) 
		{
			editor.putBoolean("isFirstRun", false); 
			editor.commit(); 
			System.out.println("isFirstRun");
		} else
		{ 
			System.out.println("notFirstRun");
		}
		dbHelper=new MyDataBaseHelper(this,"tintloveDB1.db3", 1);

		//Date test
		Date date=new Date();
		System.out.println("nochange"+date.getYear()+" "+date.getMonth()+" "+date.getDate()+" "+date.getDay());
		System.out.println("change"+(date.getYear()+1900)+" "+(date.getMonth()+1)+" "+date.getDate()+" "+date.getDay());
		date.setYear(115);
		date.setMonth(10);
		date.setDate(1);
		System.out.println("set_nochange"+date.getYear()+" "+date.getMonth()+" "+date.getDate()+" "+date.getDay());
		System.out.println("set_change"+(date.getYear()+1900)+" "+(date.getMonth()+1)+" "+date.getDate()+" "+date.getDay());
//		TinyUser user=new TinyUser();
//		user.display();
//		TinyAnni anni=new TinyAnni();
//		anni.display();
		
		
		mHandler.sendEmptyMessageDelayed(1001, SPLASH_DELAY_MILLIS);
		
	}
	
}
<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;

public class SettingFragment extends Fragment implements OnClickListener {
	
	private LinearLayout llUser;
	private LinearLayout llAboutUs;
	private LinearLayout llGitHub;
	private LinearLayout llLogout;
	private LinearLayout llExit;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_setting, container, false);
		return rootView;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		
		llUser=(LinearLayout)view.findViewById(R.id.setting_edit_user);
		llAboutUs=(LinearLayout)view.findViewById(R.id.setting_about_us);
		llGitHub=(LinearLayout)view.findViewById(R.id.setting_github);
		llLogout=(LinearLayout)view.findViewById(R.id.setting_logout);
		llExit=(LinearLayout)view.findViewById(R.id.setting_exit);
		
		llUser.setOnClickListener(this);
		llAboutUs.setOnClickListener(this);
		llGitHub.setOnClickListener(this);
		llLogout.setOnClickListener(this);
		llExit.setOnClickListener(this);
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId()==R.id.setting_edit_user){
			
			Intent iu=new Intent(getActivity(), UserEditActivity.class);
			startActivity(iu);
			
		}
		else if(v.getId()==R.id.setting_about_us){
			
			AboutUsDialog.content="    这是一款针对情侣设计的应用软件,致力于让情侣的生活更加美好。\n"
					+ "  【情侣纪念日】：记录情侣之间每一个值得纪念的日子。\n"
					+ "  【情侣愿望】：足下愿望，两个人一起去实现它。\n"
					+ "  【联系TA】：想TA？还等什么快去给TA打电话吧。\n"
					+ "  【情侣打卡】：共同完成甜蜜的小日常。\n"
					+ "  【微爱时光】：用照片记录下爱的时光。\n";
			Intent ip=new Intent(getActivity(), AboutUsDialog.class);
			startActivity(ip);
			
		}
		else if(v.getId()==R.id.setting_github){
			
			Intent ib=new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jid1311644/TinyLove"));
			startActivity(ib);
			
		}
		else if(v.getId()==R.id.setting_logout){
			
			ConfirmDialog.content="确认注销？";
			Intent ic=new Intent(getActivity(), ConfirmDialog.class);
			startActivityForResult(ic, 11);
			
		}
		else if(v.getId()==R.id.setting_exit){
			
			ConfirmDialog.content="确认退出？";
			Intent ic0=new Intent(getActivity(), ConfirmDialog.class);
			startActivityForResult(ic0, 12);
			
		}
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		if(requestCode==11&&resultCode==0){
			if(ConfirmDialog.OK){
				Intent ig=new Intent(getActivity(), GuideActivity.class);
				startActivity(ig);
				getActivity().finish();
			}
		}
		if(requestCode==12&&resultCode==0){
			if(ConfirmDialog.OK){
				System.exit(0); 
			}
		}
		
	}
	
	
	
	
}
<file_sep>package com.example.tinylove.Database;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;

import com.example.tinylove.Activity.AnniActivity;
import com.example.tinylove.Activity.MainActivity;
import com.example.tinylove.Activity.SplashActivity;

import android.content.ContentValues;
import android.database.Cursor;

public class TinyAnni {
	
	public final static String CREATE_TABLE_TINYANNI=
			"CREATE TABLE `tiny_anni` ("
			+ "`user_name` varchar(50) NOT NULL,"
			+ "`anni_id` varchar(10) NOT NULL,"
			+ "`anni_content` varchar(100) NOT NULL,"
			+ "`anni_year` varchar(4) DEFAULT NULL,"
			+ "`anni_month` varchar(2) DEFAULT NULL,"
			+ "`anni_day` varchar(2) DEFAULT NULL,"
			+ "`anni_time_type` int(1) NOT NULL,"
			+ "`anni_color` varchar(2) NOT NULL,"
			+ "`anni_frequent` varchar(4) NOT NULL,"
			+ "`anni_background` varchar(2) DEFAULT NULL,"
			+ "PRIMARY KEY (`user_name`,`anni_id`),"
			+ "FOREIGN KEY (`user_name`) REFERENCES `tiny_user` (`user_name`)"
			+ ")";
	
	public String userName;
	public String anniID;
	public String anniContent;
	public String anniYear;
	public String anniMonth;
	public String anniDay;
	public int anniTimeType;	//0公历 1农历
	public String anniColor;
	public String anniFrequent;
	public String anniBackground;
	
	
	public void init(String name){
		
		ContentValues values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0001");
		values.put("anni_content", "我们在一起");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_TOGETHER);
		values.put("anni_frequent", "无");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0002");
		values.put("anni_content", "TA的生日");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_BIRTHDAY);
		values.put("anni_frequent", "每年");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0003");
		values.put("anni_content", "我的生日");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_BIRTHDAY);
		values.put("anni_frequent", "每年");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0004");
		values.put("anni_content", "第一次拥抱");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_HUG);
		values.put("anni_frequent", "无");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0005");
		values.put("anni_content", "第一次接吻");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_TOGETHER);
		values.put("anni_frequent", "无");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0006");
		values.put("anni_content", "第一次一起去旅行");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_TRAVEL);
		values.put("anni_frequent", "无");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		values=new ContentValues();
		values.put("user_name", name);
		values.put("anni_id", "0007");
		values.put("anni_content", "我们的结婚纪念日");
		values.put("anni_year", "");
		values.put("anni_month", "");
		values.put("anni_day", "");
		values.put("anni_time_type", 0);
		values.put("anni_color", AnniActivity.ANNI_BACK_MARRY);
		values.put("anni_frequent", "每年");
		values.put("anni_background", "");
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
	}
	

	LinkedList<String> ids=new LinkedList<String>();
	LinkedList<String> events=new LinkedList<String>();
	LinkedList<String> days=new LinkedList<String>();
	LinkedList<String> y=new LinkedList<String>();
	LinkedList<String> m=new LinkedList<String>();
	LinkedList<String> d=new LinkedList<String>();
	LinkedList<Integer> back=new LinkedList<Integer>();
	
	public void getData(String name){
		String sql="select * from tiny_anni where user_name='"+name+"'";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		while(cursor.moveToNext()){
			ids.add(cursor.getString(1));
			events.add(cursor.getString(2));
			String y0=cursor.getString(3);
			String m0=cursor.getString(4);
			String d0=cursor.getString(5);
			y.add(y0);
			m.add(m0);
			d.add(d0);
			back.add(Integer.valueOf(cursor.getString(7)));
			
			if(!y0.equals("")&&!m0.equals("")&&!d0.equals("")){
				if(m0.length()==1)m0="0"+m0;
				if(d0.length()==1)d0="0"+d0;
				String date=y0+"-"+m0+"-"+d0;
				String fre=cursor.getString(8);
				days.add(getDays(date, fre)+"");
			}
			else{
				days.add("9999");
			}
		}
	}
	
	public String getFrequent(String name,String id){
		String sql="select anni_frequent from tiny_anni "
				+ " where user_name='"+name+"' "
				+ " and anni_id='"+id+"' ";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		String f="";
		while(cursor.moveToNext()){
			f=cursor.getString(0);
		}
		return f;
	}
	
	public String getBackgroundImage(String name,String id){
		String sql="select anni_background from tiny_anni "
				+ " where user_name='"+name+"' "
				+ " and anni_id='"+id+"' ";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		String f="";
		while(cursor.moveToNext()){
			f=cursor.getString(0);
		}
		return f;
	}
	
	public LinkedList<String> getIds() {
		return ids;
	}

	public void setIds(LinkedList<String> ids) {
		this.ids = ids;
	}
	
	public LinkedList<String> getEvents() {
		return events;
	}

	public void setEvents(LinkedList<String> events) {
		this.events = events;
	}

	public LinkedList<String> getDays() {
		return days;
	}

	public void setDays(LinkedList<String> days) {
		this.days = days;
	}

	public LinkedList<String> getY() {
		return y;
	}

	public void setY(LinkedList<String> y) {
		this.y = y;
	}

	public LinkedList<String> getM() {
		return m;
	}

	public void setM(LinkedList<String> m) {
		this.m = m;
	}

	public LinkedList<String> getD() {
		return d;
	}

	public void setD(LinkedList<String> d) {
		this.d = d;
	}

	public LinkedList<Integer> getBack() {
		return back;
	}

	public void setBack(LinkedList<Integer> back) {
		this.back = back;
	}
	
	public int getLastID(){
		String sql="select anni_id from tiny_anni";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		String id="";
		while(cursor.moveToNext()){
			id=cursor.getString(0);
		}
		return Integer.valueOf(id);
	}
	
	public int getDays(String date,String frequent){
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		try {
			Date lastday=sdf.parse(date);
			Date today=sdf.parse(sdf.format(new Date()));
			if(frequent.equals("无")){
				int d=daysBetween(lastday, today);
				if(d<0)d=-d;
				return d;
			}
			else if(frequent.equals("每周")){
				int weekOfD1=dayForWeek(lastday);
				int weekOfD2=dayForWeek(today);
				if(weekOfD2>weekOfD1){
					return weekOfD1-weekOfD2+7;
				}
				else{
					return weekOfD1-weekOfD2;
				}
			}
			else if(frequent.equals("每月")){
				int dL=lastday.getDate();
				int dT=today.getDate();
				if(dT<=dL){
					return dL-dT;
				}
				else{
					lastday.setMonth(today.getMonth()+1);
					return daysBetween(today, lastday);
				}
			}
			else if(frequent.equals("每年")){
				lastday.setYear(today.getYear());
				int d=daysBetween(today, lastday);
				if(d>0){
					return d;
				}
				else{
					lastday.setYear(today.getYear()+1);
					return daysBetween(today, lastday);
				}
			}
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}
	
	public int getDays(String name){
		
		String sql=" select anni_year,anni_month,anni_day from tiny_anni "
				+ " where user_name='"+name+"' "
				+ " and anni_id='0001' ";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		String date="";
		while(cursor.moveToNext()){
			if(!cursor.getString(0).equals("")&&!cursor.getString(1).equals("")&&!cursor.getString(2).equals("")){
				date=cursor.getString(0)+"-"+cursor.getString(1)+"-"+cursor.getString(2);
			}
		}
		if(!date.equals("")){
			return getDays(date,"无");
		}
		return 0;
		
	}

	public String getTargetDate(String date,String frequent){
		
		String[] weeks={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		try {
			Date lastday=sdf.parse(date);
			Date today=sdf.parse(sdf.format(new Date()));
			if(frequent.equals("无")){
				return date+"  "+weeks[dayForWeek(lastday)];
			}
			else if(frequent.equals("每周")){
				int weekOfD1=dayForWeek(lastday);
				int weekOfD2=dayForWeek(today);
				if(weekOfD2>weekOfD1){
					today.setDate(today.getDate()+weekOfD1-weekOfD2+7);
					return sdf.format(today)+"  "+weeks[dayForWeek(lastday)];
				}
				else{
					today.setDate(today.getDate()+weekOfD1-weekOfD2);
					return sdf.format(today)+"  "+weeks[dayForWeek(lastday)];
				}
			}
			else if(frequent.equals("每月")){
				int dL=lastday.getDate();
				int dT=today.getDate();
				if(dT<=dL){
					lastday.setMonth(today.getMonth());
					return sdf.format(lastday)+"  "+weeks[dayForWeek(lastday)];
				}
				else{
					lastday.setMonth(today.getMonth()+1);
					return sdf.format(lastday)+"  "+weeks[dayForWeek(lastday)];
				}
			}
			else if(frequent.equals("每年")){
				lastday.setYear(today.getYear());
				int d=daysBetween(today, lastday);
				if(d>0){
					return sdf.format(lastday)+"  "+weeks[dayForWeek(lastday)];
				}
				else{
					lastday.setYear(today.getYear()+1);
					return sdf.format(lastday)+"  "+weeks[dayForWeek(lastday)];
				}
			}
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	public String getAnniContent(String id){
		String c="";
		
		String sql="select anni_content from tiny_anni  where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		while(cursor.moveToNext()){
			c=cursor.getString(0);
		}
		
		return c;
	}
	
	public String getAnniDate(String id){
		String c="";
		
		String sql="select anni_year,anni_month,anni_day from tiny_anni  where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		while(cursor.moveToNext()){
			c=cursor.getString(0)+"-"+cursor.getString(1)+"-"+cursor.getString(2);
		}
		
		return c;
	}
	
	public int getBackground(String id){
		int i=0;
		
		String sql="select anni_background from tiny_anni  where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		while(cursor.moveToNext()){
			i=Integer.valueOf(cursor.getString(0));
		}
		return i;
		
	}
	
	public boolean setBackground(int b,String id){
		
		String sql="update tiny_anni set anni_background='"+b+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
		SplashActivity.dbHelper.getReadableDatabase().execSQL(sql);
		return true;
	}
	
	public int daysBetween(Date smdate,Date bdate){
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");  
        try {
			smdate=sdf.parse(sdf.format(smdate));
	        bdate=sdf.parse(sdf.format(bdate)); 
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}   
        Calendar cal = Calendar.getInstance();    
        cal.setTime(smdate);    
        long time1 = cal.getTimeInMillis();                 
        cal.setTime(bdate);    
        long time2 = cal.getTimeInMillis();         
        long between_days=(time2-time1)/(1000*3600*24);  
        return Integer.parseInt(String.valueOf(between_days));
	}
	
	public int dayForWeek(Date date){
		int[] weekOfDays = {0, 1, 2, 3, 4, 5, 6};        
	    Calendar calendar = Calendar.getInstance();      
	    if(date != null){        
	         calendar.setTime(date);      
	    }        
	    int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;      
	    if (w < 0){        
	        w = 0;      
	    }      
	    return weekOfDays[w];
	}
	
	public boolean addSystemAnni(){
		String[] sql=new String[5];

		sql[0]="update tiny_anni set anni_year='"+anniYear+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[1]="update tiny_anni set anni_month='"+anniMonth+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[2]="update tiny_anni set anni_day='"+anniDay+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[3]="update tiny_anni set anni_color='"+anniColor+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[4]="update tiny_anni set anni_background='"+anniBackground+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		
		for(int i=0;i<5;i++){
			SplashActivity.dbHelper.getReadableDatabase().execSQL(sql[i]);
		}
		
		return true;
	}
	
	public boolean updateSystemAnni(){
		
		String[] sql=new String[4];

		sql[0]="update tiny_anni set anni_year='"+anniYear+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[1]="update tiny_anni set anni_month='"+anniMonth+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[2]="update tiny_anni set anni_day='"+anniDay+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[3]="update tiny_anni set anni_color='"+anniColor+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		
		for(int i=0;i<4;i++){
			SplashActivity.dbHelper.getReadableDatabase().execSQL(sql[i]);
		}
		
		return true;
		
	}
	
	public boolean addAnni(){
		
		ContentValues values=new ContentValues();
		values.put("user_name", userName);
		values.put("anni_id", anniID);
		values.put("anni_content", anniContent);
		values.put("anni_year", anniYear);
		values.put("anni_month", anniMonth);
		values.put("anni_day", anniDay);
		values.put("anni_time_type", 0);
		values.put("anni_color", anniColor);
		values.put("anni_frequent", anniFrequent);
		values.put("anni_background", anniBackground);
		SplashActivity.dbHelper.getReadableDatabase().insert("tiny_anni", null, values);
		
		return true;
	}
	
	public boolean updateAnni(){
		
		String[] sql=new String[6];

		sql[0]="update tiny_anni set anni_year='"+anniYear+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[1]="update tiny_anni set anni_month='"+anniMonth+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[2]="update tiny_anni set anni_day='"+anniDay+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[3]="update tiny_anni set anni_color='"+anniColor+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[4]="update tiny_anni set anni_content='"+anniContent+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		sql[5]="update tiny_anni set anni_frequent='"+anniFrequent+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+anniID+"'";
		
		for(int i=0;i<6;i++){
			SplashActivity.dbHelper.getReadableDatabase().execSQL(sql[i]);
		}
		
		return true;
		
	}
	
	public boolean deleteSystemAnni(String id){
		
		String[] sql=new String[5];
		int a;
		if((a=Integer.valueOf(id))<=6){
			sql[0]="update tiny_anni set anni_year='' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			sql[1]="update tiny_anni set anni_month='' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			sql[2]="update tiny_anni set anni_day='' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			sql[3]="update tiny_anni set anni_color='"+(a+6)+"' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			sql[4]="update tiny_anni set anni_background='' where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			for(int i=0;i<5;i++){
				SplashActivity.dbHelper.getReadableDatabase().execSQL(sql[i]);
			}
			return true;
		}
		else{
			return false;
		}
		
	}
	
	public boolean deleteAnni(String id){
		int a;
		if((a=Integer.valueOf(id))>6){
			String sql="delete from tiny_anni where user_name='"+MainActivity.currentUser+"' and anni_id='"+id+"'";
			SplashActivity.dbHelper.getReadableDatabase().execSQL(sql);
			return true;
		}
		else{
			return false;
		}
	}
	
	public void display(){
		String sql="select * from tiny_anni";
		Cursor cursor=SplashActivity.dbHelper.getReadableDatabase().rawQuery(sql, null);
		int count=0;
		while(cursor.moveToNext()){
			System.out.println((count++)+"    ;"+cursor.getString(0)+"    ;"+cursor.getString(1)+"    ;"+cursor.getString(2)+"    ;"
					+cursor.getString(3)+"    ;"+cursor.getInt(4)+"    ;"+cursor.getString(5)+"    ;"+cursor.getInt(6)
					+"    ;"+cursor.getString(7)+"    ;"+cursor.getString(8)+"   ;"+cursor.getString(9));
		}
	}

}
<file_sep>package com.example.tinylove.Interface;

public interface ItemClickListener {
	public void onItemClickListener(int position);
}
<file_sep>package com.example.tinylove.Activity;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyTimePicture;
import com.example.tinylove.View.OutlineContainer;
import com.example.tinylove.View.PictureView;
import com.example.tinylove.View.PictureView.TransitionEffect;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class TimeFragment extends Fragment implements OnClickListener {
	
	private PictureView pictureView;
	
	private TextView mode;
	private ImageView add;
	private ImageView delete;
	
	public static TransitionEffect effect=TransitionEffect.Tablet;
	
	private View v;
	
	public static String PATH="";
	
	private int position=0;
	
	private LinkedList<String> pictures=new LinkedList<String>();

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_time, container, false);
		return rootView;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		this.v=view;
		
		mode=(TextView)view.findViewById(R.id.time_picture_mode);
		add=(ImageView)view.findViewById(R.id.time_picture_add);
		delete=(ImageView)view.findViewById(R.id.time_picture_delete);
		
		setPlayMode(view, effect);
		
		mode.setOnClickListener(this);
		add.setOnClickListener(this);
		delete.setOnClickListener(this);
		
	}
	
	private void setPlayMode(View v,TransitionEffect effect){
		
		TinyTimePicture time=new TinyTimePicture();
		time.getData(MainActivity.currentUser);
		pictures=time.getPictures();
		
//		for(int i=0;i<pictures.size();i++)
//			System.out.println(i+"   "+pictures.get(i));
//		System.out.println(effect);
		
		pictureView = (PictureView)v.findViewById(R.id.time_picture);
		pictureView.setTransitionEffect(effect);
		pictureView.setAdapter(new MyPictureAdapter(pictures));
		pictureView.setPageMargin(30);
		
		pictureView.setOnPageChangeListener(new OnPageChangeListener() {
			
			@Override
			public void onPageSelected(int arg0) {
				// TODO Auto-generated method stub
				position=arg0;
			}
			
			@Override
			public void onPageScrolled(int arg0, float arg1, int arg2) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onPageScrollStateChanged(int arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		
	}
	
	
	private class MyPictureAdapter extends PagerAdapter{
		
		LinkedList<String> pictures;
		
		public MyPictureAdapter(LinkedList<String> pictures) {
			// TODO Auto-generated constructor stub
			this.pictures=pictures;
		}
		
		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return pictures.size();
		}

		@Override
		public boolean isViewFromObject(View view, Object arg1) {
			// TODO Auto-generated method stub
			if (view instanceof OutlineContainer)
			{
				return ((OutlineContainer) view).getChildAt(0) == arg1;
			} else
			{
				return view == arg1;
			}
		}

		@Override
		public void destroyItem(ViewGroup container, int position, Object object) {
			// TODO Auto-generated method stub
			container.removeView(pictureView.findViewFromObject(position));
		}

		@Override
		public Object instantiateItem(ViewGroup container, int position) {
			// TODO Auto-generated method stub
			
			ImageView image=new ImageView(getActivity());
			Bitmap bitmap=getLoacalBitmap(pictures.get(position));
			image.setImageBitmap(bitmap);
			container.addView(image, LayoutParams.MATCH_PARENT,
					LayoutParams.MATCH_PARENT);
			
			pictureView.setObjectForPosition(image, position);
			return image;
		}

	}
	
	public static Bitmap getLoacalBitmap(String url) {
        try {
             FileInputStream fis = new FileInputStream(url);
             return BitmapFactory.decodeStream(fis);  ///把流转化为Bitmap图片        

          } catch (FileNotFoundException e) {
             e.printStackTrace();
             return null;
        }
   }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		switch (v.getId()) {
		case R.id.time_picture_add:
			GetPictureDialog.isHomePage=false;
			View vt=new View(getActivity());
			GetPictureDialog.imageView=vt;
			SimpleDateFormat sdf=new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
			String name=sdf.format(new Date(System.currentTimeMillis()));
			name="image"+name+".png";
			GetPictureDialog.fileName=name;
			Intent i=new Intent(getActivity(), GetPictureDialog.class);
			startActivityForResult(i,8);
			break;

		case R.id.time_picture_delete:
			if(pictures.size()>0){
				ConfirmDialog.content="确认删除这张图片吗？";
				Intent ic=new Intent(getActivity(), ConfirmDialog.class);
				startActivityForResult(ic,10);
			}
			break;
			
		case R.id.time_picture_mode:
			Intent intent=new Intent(getActivity(), TimeSelectModeDialog.class);
			startActivityForResult(intent, 9);
			break;
			
		default:
			break;
		}
		
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		if(requestCode==9&&resultCode==0){
			setPlayMode(v, effect);
		}
		if(requestCode==8&&resultCode==0){
			if(GetPictureDialog.isSelect){
				TinyTimePicture picture=new TinyTimePicture();
				picture.addPath(MainActivity.currentUser, TimeFragment.PATH);
				setPlayMode(v, TransitionEffect.Tablet);
			}
		}
		if(requestCode==10&&resultCode==0){
			if(ConfirmDialog.OK){
				TinyTimePicture time=new TinyTimePicture();
				time.getData(MainActivity.currentUser);
				time.deletePath(MainActivity.currentUser, time.getPictures().get(position));
				setPlayMode(v, TransitionEffect.Tablet);
			}
		}
	}
	
	

}



<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyWish;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;

public class WishDetailDialog extends Activity {
	
	private TextView textWishDetailContent;
	private TextView textWishDetailTime;
	private CheckBox imageWishIsFinish;
	private TextView textWishConfirm;
	private TextView textWishDelete;
	
	public static String wishID="";
	public static String wishCon="";
	public static String wishTime="";
	public static int wishState=0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_wish_detail);
		
		initView();
		setOnListeners();
		
	}

	private void initView() {
		// TODO Auto-generated method stub
		textWishDetailContent=(TextView)findViewById(R.id.wish_detail_content);
		textWishDetailTime=(TextView)findViewById(R.id.wish_detail_time);
		imageWishIsFinish=(CheckBox)findViewById(R.id.wish_detail_finish);
		textWishConfirm=(TextView)findViewById(R.id.wish_ok);
		textWishDelete=(TextView)findViewById(R.id.wish_delete);
		
		textWishDetailContent.setText(wishCon);
		textWishDetailTime.setText(wishTime);
		if(wishState==1){
			imageWishIsFinish.setChecked(true);
			imageWishIsFinish.setBackgroundResource(R.drawable.wish_finish);
		}
		else if(wishState==0){
			imageWishIsFinish.setChecked(false);
			imageWishIsFinish.setBackgroundResource(R.drawable.wish_no_finish);
		}
		
	}

	private void setOnListeners() {
		// TODO Auto-generated method stub
		imageWishIsFinish.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				// TODO Auto-generated method stub
				if(isChecked){
					imageWishIsFinish.setBackgroundResource(R.drawable.wish_finish);
					wishState=1;
				}
				else{
					imageWishIsFinish.setBackgroundResource(R.drawable.wish_no_finish);
					wishState=0;
				}
			}
		});
		
		textWishConfirm.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				TinyWish wish=new TinyWish();
				wish.setState(WishDetailDialog.wishID, wishState);
				WishActivity.activity.finish();
				Intent intent=new Intent(WishDetailDialog.this, WishActivity.class);
				startActivity(intent);
				finish();
			}
		});
		
		textWishDelete.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//delete
				TinyWish wish=new TinyWish();
				wish.delete(WishDetailDialog.wishID);
				WishActivity.activity.finish();
				Intent intent=new Intent(WishDetailDialog.this, WishActivity.class);
				startActivity(intent);
				finish();
			}
		});
	}

}
<file_sep>package com.example.tinylove.Adapter;

import java.util.LinkedList;

import com.example.tinylove.R;
import com.example.tinylove.Interface.ItemClickListener;
import com.example.tinylove.View.CustomImageView;

import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.wifi.WifiEnterpriseConfig;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.ViewHolder>{
	
	//添加纪念日时标签背景颜色和图片
	final int[] color={R.color.eventsColor1,R.color.eventsColor2,R.color.eventsColor3,
			R.color.eventsColor4,R.color.eventsColor5,R.color.eventsColor6,
			R.color.eventsColor7,R.drawable.anni_together_icon,R.drawable.anni_birthday_icon,
			R.drawable.anni_kiss_icon,R.drawable.anni_hug_icon,R.drawable.anni_marry_icon,
			R.drawable.anni_travel_icon};

	//纪念日list的相关参数
	LinkedList<String> dataAnniEvent;
	LinkedList<String> dataAnniDays;
	LinkedList<String> dataAnniYear;
	LinkedList<String> dataAnniMonth;
	LinkedList<String> dataAnniDay;
	LinkedList<Integer> dataAnniColor;

	
	ItemClickListener itemClickListener;
	
	public void setOnClickListener(ItemClickListener itemClickListener){
		this.itemClickListener=itemClickListener;
	}
	
	//纪念日list数据初始化
	public MyRecyclerAdapter(LinkedList<String> events,LinkedList<String> days,
			LinkedList<String> Y,LinkedList<String> M,LinkedList<String> D,LinkedList<Integer> back){
		this.dataAnniDays=days;
		this.dataAnniEvent=events;
		this.dataAnniYear=Y;
		this.dataAnniMonth=M;
		this.dataAnniDay=D;
		this.dataAnniColor=back;
	}

	@Override
	public int getItemCount() {
		// TODO Auto-generated method stub
		return dataAnniEvent.size();
	}

	@Override
	public void onBindViewHolder(MyRecyclerAdapter.ViewHolder viewHolder, int position) {
		// TODO Auto-generated method stub
		
		if(dataAnniColor.get(position)>6){
			viewHolder.textAnniYandM.setVisibility(View.GONE);
			viewHolder.textAnniD.setVisibility(View.GONE);
			viewHolder.imageBack.setVisibility(View.VISIBLE);
			
			viewHolder.textAnniDay.setVisibility(View.GONE);
			viewHolder.textAnniLong.setVisibility(View.GONE);
			viewHolder.imageAddEvent.setVisibility(View.VISIBLE);
				
			viewHolder.llAnniBack.setBackgroundColor(Color.TRANSPARENT);
			viewHolder.imageBack.setImageResource(color[dataAnniColor.get(position)]);
			
			viewHolder.textAnniEvent.setText(dataAnniEvent.get(position));
		}
		else{
			viewHolder.textAnniYandM.setVisibility(View.VISIBLE);
			viewHolder.textAnniD.setVisibility(View.VISIBLE);
			viewHolder.imageBack.setVisibility(View.GONE);
			
			viewHolder.textAnniDay.setVisibility(View.VISIBLE);
			viewHolder.textAnniLong.setVisibility(View.VISIBLE);
			viewHolder.imageAddEvent.setVisibility(View.GONE);
			
			viewHolder.textAnniYandM.setText(dataAnniYear.get(position)+" "+dataAnniMonth.get(position));
			viewHolder.textAnniD.setText(dataAnniDay.get(position));
			viewHolder.textAnniEvent.setText(dataAnniEvent.get(position));
			viewHolder.textAnniLong.setText(dataAnniDays.get(position));
			viewHolder.llAnniBack.setBackgroundResource(color[dataAnniColor.get(position)]);
		}	
	}

	@Override
	public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int position) {
		// TODO Auto-generated method stub
		View view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.anni_recycler_item, viewGroup,false);
		return new ViewHolder(view, itemClickListener);
	}
	
	
	
	class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

		//纪念日list_item涉及到的控件
		LinearLayout llAnniBack;
		TextView textAnniYandM;
		TextView textAnniD;
		ImageView imageBack;
		
		TextView textAnniEvent;
		
		TextView textAnniLong;
		TextView textAnniDay;
		ImageView imageAddEvent;
		
		ItemClickListener listener;

		public ViewHolder(View itemView,ItemClickListener itemClickListener) {
			super(itemView);
			// TODO Auto-generated constructor stub
			//纪念日list_item涉及到的控件
			llAnniBack=(LinearLayout)itemView.findViewById(R.id.anni_recycler_item_picture);
			textAnniYandM=(TextView)itemView.findViewById(R.id.anni_recycler_item_text_yearmonth);
			textAnniD=(TextView)itemView.findViewById(R.id.anni_recycler_item_text_day);
			imageBack=(ImageView)itemView.findViewById(R.id.anni_recycler_item_back_picture);
			
			textAnniEvent=(TextView)itemView.findViewById(R.id.anni_recycler_item_content);
			
			textAnniLong=(TextView)itemView.findViewById(R.id.anni_recycler_item_days);
			textAnniDay=(TextView)itemView.findViewById(R.id.anni_recycler_item_day);
			imageAddEvent=(ImageView)itemView.findViewById(R.id.anni_recycler_item_add_event);

			
			itemView.setOnClickListener(this);
			
			this.listener=itemClickListener;
		}

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			listener.onItemClickListener(getPosition());
		}

	}
	
}
<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;
import com.example.tinylove.Adapter.MyBackgroundRecyclerAdapter;
import com.example.tinylove.Adapter.MyRecyclerAdapter;
import com.example.tinylove.Database.TinyAnni;
import com.example.tinylove.Interface.ItemClickListener;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;


public class SelectBackgroundActivity extends Activity {
	
	final int[] backgroundBigBlur={R.drawable.anni_bg_large_blur_1,R.drawable.anni_bg_large_blur_2,R.drawable.anni_bg_large_blur_3,R.drawable.anni_bg_large_blur_4,
			R.drawable.anni_bg_large_blur_5,R.drawable.anni_bg_large_blur_6,R.drawable.anni_bg_large_blur_7,R.drawable.anni_bg_large_blur_8,
			R.drawable.anni_bg_large_blur_9,R.drawable.anni_bg_large_blur_10,R.drawable.anni_bg_large_blur_11,R.drawable.anni_bg_large_blur_12,
			R.drawable.anni_bg_large_blur_13,R.drawable.anni_bg_large_blur_14,R.drawable.anni_bg_large_blur_15,R.drawable.anni_bg_large_blur_16,
			R.drawable.anni_bg_large_blur_17,R.drawable.anni_bg_large_blur_18,R.drawable.anni_bg_large_blur_19,R.drawable.anni_bg_large_blur_20};
	final int[] backgroundBig={R.drawable.anni_bg_large_1,R.drawable.anni_bg_large_2,R.drawable.anni_bg_large_3,R.drawable.anni_bg_large_4,R.drawable.anni_bg_large_5,
			R.drawable.anni_bg_large_6,R.drawable.anni_bg_large_7,R.drawable.anni_bg_large_8,R.drawable.anni_bg_large_9,R.drawable.anni_bg_large_10,
			R.drawable.anni_bg_large_11,R.drawable.anni_bg_large_12,R.drawable.anni_bg_large_13,R.drawable.anni_bg_large_14,R.drawable.anni_bg_large_15,
			R.drawable.anni_bg_large_16,R.drawable.anni_bg_large_17,R.drawable.anni_bg_large_18,R.drawable.anni_bg_large_19,R.drawable.anni_bg_large_20};
	
	
	private ImageView back;
	private TextView complete;
	
	private RelativeLayout bigFlurBackGround;
	
	private LinearLayout bigBackground;
	private TextView text1;
	private TextView text2;
	private TextView text3;
	
	private RecyclerView selectBackground;
	private RecyclerView.LayoutManager layoutManage;
	private MyBackgroundRecyclerAdapter adapter;	
	
	public static String anniID="";
	
	public static int IMAGE=0;
	
	private int lastImage=0;
	public static boolean isDetail;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_select_background);
		
		initView();
		setOnListeners();
		
	}

	private void initView() {
		// TODO Auto-generated method stub
		back=(ImageView)findViewById(R.id.add_anni_background_back);
		complete=(TextView)findViewById(R.id.add_anni_background_next);
		
		bigFlurBackGround=(RelativeLayout)findViewById(R.id.add_anni_flur_background);
		bigBackground=(LinearLayout)findViewById(R.id.add_anni_background_big_picture);
		bigFlurBackGround.setBackgroundResource(backgroundBigBlur[IMAGE]);
		bigBackground.setBackgroundResource(backgroundBig[IMAGE]);
		
		text1=(TextView)findViewById(R.id.add_anni_background_big_picture_text1);
		text2=(TextView)findViewById(R.id.add_anni_background_big_picture_text2);
		text3=(TextView)findViewById(R.id.add_anni_background_big_picture_text3);
		
		selectBackground=(RecyclerView)findViewById(R.id.add_anni_recycler);
		selectBackground.setHasFixedSize(true);
		layoutManage=new LinearLayoutManager(SelectBackgroundActivity.this);
		((LinearLayoutManager) layoutManage).setOrientation(LinearLayoutManager.HORIZONTAL);
		selectBackground.setLayoutManager(layoutManage);
		
		adapter=new MyBackgroundRecyclerAdapter(IMAGE);
		selectBackground.setAdapter(adapter);
		
	}

	private void setOnListeners() {
		// TODO Auto-generated method stub
		back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(isDetail){
					Intent ii=new Intent(SelectBackgroundActivity.this, AnniDetailActivity.class);
					startActivity(ii);
					SelectBackgroundActivity.isDetail=false;
				}
				SelectBackgroundActivity.this.finish();
			}
		});
		
		complete.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				AnniDetailActivity.IMAGE=SelectBackgroundActivity.IMAGE;
				AddAnniActivity.IMAGE=SelectBackgroundActivity.IMAGE;
				TinyAnni anni=new TinyAnni();
				//anni.display();
				anni.setBackground(SelectBackgroundActivity.IMAGE, SelectBackgroundActivity.anniID);
				//anni.display();
				if(isDetail){
					Intent ii=new Intent(SelectBackgroundActivity.this, AnniDetailActivity.class);
					startActivity(ii);
					SelectBackgroundActivity.isDetail=false;
					SelectBackgroundActivity.this.finish();
				}
				finish();
				
//				Intent i=new Intent(SelectBackgroundActivity.this, SelectBackgroundActivity.class);
//				startActivity(i);
//				finish();
//				
			}
		});
		
		adapter.setOnClickListener(new ItemClickListener() {
			
			@Override
			public void onItemClickListener(int position) {
				// TODO Auto-generated method stub
				SelectBackgroundActivity.IMAGE=position;
				if(lastImage==position);
				else{
					bigBackground.setBackgroundResource(backgroundBig[position]);
					bigFlurBackGround.setBackgroundResource(backgroundBigBlur[position]);
					lastImage=position;
				}
//				View v1=layoutManage.findViewByPosition(position);
//				View v2=layoutManage.findViewByPosition(adapter.getSelectID());
//				
//				ImageView i1=(ImageView)v1.findViewById(R.id.add_anni_recycler_item_select);
//				i1.setVisibility(View.VISIBLE);
//				
//				ImageView i2=(ImageView)v2.findViewById(R.id.add_anni_recycler_item_select);
//				i2.setVisibility(View.GONE);
//				
//				adapter.setSelectID(position);
				

				
			}
		});
		
	}
	
}




<file_sep>package com.example.tinylove.Adapter;

import com.example.tinylove.R;
import com.example.tinylove.Adapter.MyRecyclerAdapter.ViewHolder;
import com.example.tinylove.Interface.ItemClickListener;
import com.example.tinylove.View.CustomImageView;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioButton;

public class MyBackgroundRecyclerAdapter extends RecyclerView.Adapter<MyBackgroundRecyclerAdapter.ViewHolder>{

	//设置纪念日背景图片
	final int[] backgroundSmall={R.drawable.anni_bg_preview_1,R.drawable.anni_bg_preview_2,R.drawable.anni_bg_preview_3,R.drawable.anni_bg_preview_4,R.drawable.anni_bg_preview_5,
			R.drawable.anni_bg_preview_6,R.drawable.anni_bg_preview_7,R.drawable.anni_bg_preview_8,R.drawable.anni_bg_preview_9,R.drawable.anni_bg_preview_10,
			R.drawable.anni_bg_preview_11,R.drawable.anni_bg_preview_12,R.drawable.anni_bg_preview_13,R.drawable.anni_bg_preview_14,R.drawable.anni_bg_preview_15,
			R.drawable.anni_bg_preview_16,R.drawable.anni_bg_preview_17,R.drawable.anni_bg_preview_18,R.drawable.anni_bg_preview_19,R.drawable.anni_bg_preview_20};
	
	//选中背景图片的ID
	private int selectID=-1;
	
	ItemClickListener itemClickListener;
	
	public int getSelectID() {
		return selectID;
	}

	public void setSelectID(int selectID) {
		this.selectID = selectID;
	}

	//选背景图片list数据初始化
	public MyBackgroundRecyclerAdapter(int id){
		this.selectID=id;
	}
	
	public void setOnClickListener(ItemClickListener itemClickListener){
		this.itemClickListener=itemClickListener;
	}
		
	@Override
	public int getItemCount() {
		// TODO Auto-generated method stub
		return backgroundSmall.length;
	}

	@Override
	public void onBindViewHolder(MyBackgroundRecyclerAdapter.ViewHolder viewHolder, int position) {
		// TODO Auto-generated method stub
		viewHolder.llBackPicture.setImageResource(backgroundSmall[position]);
//		viewHolder.imageSelect.setVisibility(View.GONE);
//		viewHolder.imageSelect.setChecked(false);
//		if(position==selectID){
//			viewHolder.imageSelect.setVisibility(View.VISIBLE);
//			viewHolder.imageSelect.setChecked(false);
//		}
	}

	@Override
	public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int position) {
		// TODO Auto-generated method stub
		View view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.add_anni_recycler_item, viewGroup,false);
		return new ViewHolder(view, itemClickListener);
	}
	
	
	class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

		//纪念日背景list_item涉及到的控件
		CustomImageView llBackPicture;
		//RadioButton imageSelect;
		
		ItemClickListener listener;
		
		public ViewHolder(View itemView,ItemClickListener itemClickListener) {
			super(itemView);
			// TODO Auto-generated constructor stub
			//纪念日背景list_item涉及到的控件
			llBackPicture=(CustomImageView)itemView.findViewById(R.id.add_anni_recycler_item_picture);
			llBackPicture.setType(CustomImageView.TYPE_ROUND);
			llBackPicture.setRoundRadius(10);
			
			//imageSelect=(RadioButton)itemView.findViewById(R.id.add_anni_recycler_item_select);
			
			itemView.setOnClickListener(this);
			
			this.listener=itemClickListener;
		}

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			listener.onItemClickListener(getPosition());
			
		}
		
	}
	

}
<file_sep>package com.example.tinylove.Activity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyAnni;
import com.example.tinylove.View.SwitchView;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class AnniEditActivity extends Activity implements OnClickListener {
	
	private ImageView back;
	private TextView complete;
	
	private ImageView imageSelectColor;
	private EditText anniContent;

	private ImageView imageSelectEventColor1;
	private ImageView imageSelectEventColor2;
	private ImageView imageSelectEventColor3;
	private ImageView imageSelectEventColor4;
	private ImageView imageSelectEventColor5;
	private ImageView imageSelectEventColor6;
	private ImageView imageSelectEventColor7;
	
	private RelativeLayout rlTime;
	private TextView textEventTime;
	private SwitchView switchView;
	
	private RelativeLayout rlRemind;
	private TextView textRemind;
	
	private RelativeLayout rlDelete;
	
	private boolean isSystemAnni;
	
	private TinyAnni anni;

	public static String anniID="";
	public static String DATE_YEAR="";
	public static String DATE_MONTH="";
	public static String DATE_DAY="";
	public static String FREQUENT="";
	public static int BACKCOLOR=1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_anni_edit);
		
		anni=new TinyAnni();
		anni.getData(MainActivity.currentUser);
		int i=anni.getIds().indexOf(anniID);
		DATE_YEAR=anni.getY().get(i);
		DATE_MONTH=anni.getM().get(i);
		DATE_DAY=anni.getD().get(i);
		FREQUENT=anni.getFrequent(MainActivity.currentUser, anniID);
		BACKCOLOR=anni.getBack().get(i);
		
		initView();
		setOnListeners();
		
	}

	private void initView() {
		// TODO Auto-generated method stub
		back=(ImageView)findViewById(R.id.anni_edit_back);
		complete=(TextView)findViewById(R.id.anni_edit_next);
		
		imageSelectColor=(ImageView)findViewById(R.id.anni_edit_select_color);
		anniContent=(EditText)findViewById(R.id.anni_edit_event_name);
		anniContent.setEnabled(true);

		imageSelectEventColor1=(ImageView)findViewById(R.id.anni_edit_select_1);
		imageSelectEventColor2=(ImageView)findViewById(R.id.anni_edit_select_2);
		imageSelectEventColor3=(ImageView)findViewById(R.id.anni_edit_select_3);
		imageSelectEventColor4=(ImageView)findViewById(R.id.anni_edit_select_4);
		imageSelectEventColor5=(ImageView)findViewById(R.id.anni_edit_select_5);
		imageSelectEventColor6=(ImageView)findViewById(R.id.anni_edit_select_6);
		imageSelectEventColor7=(ImageView)findViewById(R.id.anni_edit_select_7);

		rlTime=(RelativeLayout)findViewById(R.id.anni_edit_rl_time);
		textEventTime=(TextView)findViewById(R.id.anni_edit_text_time);
		switchView=(SwitchView)findViewById(R.id.anni_edit_time_switch);
		switchView.setState(true);
		switchView.setVisibility(View.GONE);

		rlRemind=(RelativeLayout)findViewById(R.id.anni_edit_rl_remind);
		rlRemind.setEnabled(true);
		textRemind=(TextView)findViewById(R.id.anni_edit_remind_frequent);
		
		rlDelete=(RelativeLayout)findViewById(R.id.anni_edit_rl_delete);

		anni=new TinyAnni();
		String s=anni.getAnniDate(anniID);
		
		try {
			SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
			Date d=sdf.parse(s);
			
			s=(d.getYear()+1900)+"年"+(d.getMonth()+1)+"月"+d.getDate()+"日";
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		textEventTime.setText(s);
		if(AnniEditActivity.anniID.equals("0001")||AnniEditActivity.anniID.equals("0002")||AnniEditActivity.anniID.equals("0003")||
				AnniEditActivity.anniID.equals("0004")||AnniEditActivity.anniID.equals("0005")||AnniEditActivity.anniID.equals("0006")||
				AnniEditActivity.anniID.equals("0007")){
			anni=new TinyAnni();
			isSystemAnni=true;
			switch (Integer.valueOf(AnniEditActivity.anniID)) {
			case 1:
				anniContent.setText("我们在一起啦");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0001"));
				break;
				
			case 2:
				anniContent.setText("TA的生日");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0002"));
				break;
				
			case 3:
				anniContent.setText("我的生日");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0003"));
				break;
				
			case 4:
				anniContent.setText("第一次拥抱的日子");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0004"));
				break;
				
			case 5:
				anniContent.setText("第一次接吻的日子");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0005"));
				break;
				
			case 6:
				anniContent.setText("第一次一起去旅行的日子");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0006"));
				break;
				
			case 7:
				anniContent.setText("我们结婚啦");
				anniContent.setEnabled(false);
				rlRemind.setEnabled(false);
				rlRemind.setBackgroundColor(Color.WHITE);
				textRemind.setText(anni.getFrequent(MainActivity.currentUser, "0007"));
				break;
				
			default:
				break;
			}
		}
		else{
			isSystemAnni=false;
			anniContent.setEnabled(true);
			rlRemind.setEnabled(true);
			anniContent.setText(anni.getAnniContent(anniID));
			textRemind.setText(anni.getFrequent(MainActivity.currentUser, anniID));
		}
		
	}
	
	private void setOnListeners() {
		// TODO Auto-generated method stub
		
		back.setOnClickListener(this);
		complete.setOnClickListener(this);
		
		imageSelectEventColor1.setOnClickListener(this);
		imageSelectEventColor2.setOnClickListener(this);
		imageSelectEventColor3.setOnClickListener(this);
		imageSelectEventColor4.setOnClickListener(this);
		imageSelectEventColor5.setOnClickListener(this);
		imageSelectEventColor6.setOnClickListener(this);
		imageSelectEventColor7.setOnClickListener(this);
		
		rlTime.setOnClickListener(this);
		//switchView.setOnStateChangedListener(this);
		
		rlRemind.setOnClickListener(this);
		
		rlDelete.setOnClickListener(this);
		
	}
	
	private void setSelectColor(int id){
		imageSelectEventColor1.setImageResource(R.drawable.event_color_1);
		imageSelectEventColor2.setImageResource(R.drawable.event_color_2);
		imageSelectEventColor3.setImageResource(R.drawable.event_color_3);
		imageSelectEventColor4.setImageResource(R.drawable.event_color_4);
		imageSelectEventColor5.setImageResource(R.drawable.event_color_5);
		imageSelectEventColor6.setImageResource(R.drawable.event_color_6);
		imageSelectEventColor7.setImageResource(R.drawable.event_color_7);
		switch (id) {
		case 1:
			AnniEditActivity.BACKCOLOR=0;
			imageSelectEventColor1.setImageResource(R.drawable.add_event_color_1);
			imageSelectColor.setImageResource(R.drawable.event_color_1);
			break;
		case 2:
			AnniEditActivity.BACKCOLOR=1;
			imageSelectEventColor2.setImageResource(R.drawable.add_event_color_2);
			imageSelectColor.setImageResource(R.drawable.event_color_2);
			break;
		case 3:
			AnniEditActivity.BACKCOLOR=2;
			imageSelectEventColor3.setImageResource(R.drawable.add_event_color_3);
			imageSelectColor.setImageResource(R.drawable.event_color_3);
			break;
		case 4:
			AnniEditActivity.BACKCOLOR=3;
			imageSelectEventColor4.setImageResource(R.drawable.add_event_color_4);
			imageSelectColor.setImageResource(R.drawable.event_color_4);
			break;
		case 5:
			AnniEditActivity.BACKCOLOR=4;
			imageSelectEventColor5.setImageResource(R.drawable.add_event_color_5);
			imageSelectColor.setImageResource(R.drawable.event_color_5);
			break;
		case 6:
			AnniEditActivity.BACKCOLOR=5;
			imageSelectEventColor6.setImageResource(R.drawable.add_event_color_6);
			imageSelectColor.setImageResource(R.drawable.event_color_6);
			break;
		case 7:
			AnniEditActivity.BACKCOLOR=6;
			imageSelectEventColor7.setImageResource(R.drawable.add_event_color_7);
			imageSelectColor.setImageResource(R.drawable.event_color_7);
			break;
		default:
			break;
		}
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		
		case R.id.anni_edit_back:
			Intent i=new Intent(AnniEditActivity.this, AnniDetailActivity.class);
			startActivity(i);
			finish();
			break;
			
		case R.id.anni_edit_next:
			String year=AnniEditActivity.DATE_YEAR;
			String month=AnniEditActivity.DATE_MONTH;
			String day=AnniEditActivity.DATE_DAY;
			String color=AnniEditActivity.BACKCOLOR+"";
			if(isSystemAnni){
				if(year.equals("")||month.equals("")||day.equals("")){
					PromptDialog.title="Error";
					PromptDialog.content="还有信息未填写！";
					Intent di=new Intent(AnniEditActivity.this, PromptDialog.class);
					startActivity(di);
				}
				else{
					anni=new TinyAnni();
					anni.userName=MainActivity.currentUser;
					anni.anniID=AnniEditActivity.anniID;
					anni.anniYear=year;
					anni.anniMonth=month;
					anni.anniDay=day;
					anni.anniColor=color;
					anni.updateSystemAnni();
					AnniEditActivity.DATE_YEAR="";
					AnniEditActivity.DATE_MONTH="";
					AnniEditActivity.DATE_DAY="";
					AnniEditActivity.BACKCOLOR=1;
					Intent i0=new Intent(AnniEditActivity.this, AnniDetailActivity.class);
					startActivity(i0);
					finish();
				}
			}
			else{
				String event=anniContent.getText().toString();
				String frequent=textRemind.getText().toString();
				if(year.equals("")||month.equals("")||day.equals("")||event==null||event.equals("")){
					PromptDialog.title="Error";
					PromptDialog.content="还有信息未填写！";
					Intent di=new Intent(AnniEditActivity.this, PromptDialog.class);
					startActivity(di);
				}
				else{
					anni=new TinyAnni();
					anni.userName=MainActivity.currentUser;
					anni.anniID=AnniEditActivity.anniID;
					anni.anniYear=year;
					anni.anniMonth=month;
					anni.anniDay=day;
					anni.anniColor=color;
					anni.anniFrequent=frequent;
					anni.anniContent=event;
					anni.updateAnni();
					AnniEditActivity.DATE_YEAR="";
					AnniEditActivity.DATE_MONTH="";
					AnniEditActivity.DATE_DAY="";
					AnniEditActivity.BACKCOLOR=1;
					Intent i0=new Intent(AnniEditActivity.this, AnniDetailActivity.class);
					startActivity(i0);
					finish();
				}
			}
			
			break;
			
		case R.id.anni_edit_select_1:
			setSelectColor(1);
			break;
			
		case R.id.anni_edit_select_2:
			setSelectColor(2);
			break;
			
		case R.id.anni_edit_select_3:
			setSelectColor(3);
			break;
			
		case R.id.anni_edit_select_4:
			setSelectColor(4);
			break;
			
		case R.id.anni_edit_select_5:
			setSelectColor(5);
			break;
			
		case R.id.anni_edit_select_6:
			setSelectColor(6);
			break;
			
		case R.id.anni_edit_select_7:
			setSelectColor(7);
			break;
			
		case R.id.anni_edit_rl_time:
			Intent intentSelectDate=new Intent(AnniEditActivity.this, SelectDateDialog.class);
			startActivityForResult(intentSelectDate,2);
			break;
			
		case R.id.anni_edit_rl_remind:
			Intent intentSelectFrequent=new Intent(AnniEditActivity.this, SelectFrequentDialog.class);
			startActivityForResult(intentSelectFrequent,3);
			break;
			
		case R.id.anni_edit_rl_delete:
			if(isSystemAnni){
				anni.deleteSystemAnni(anniID);
			}
			else{
				anni.deleteAnni(anniID);
			}
			Intent intentList=new Intent(AnniEditActivity.this, AnniActivity.class);
			startActivity(intentList);
			finish();
			break;
			
		default:
			break;
		}
	}
	
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		if(requestCode==2&&resultCode==0){
			
			if(AddAnniActivity.DATE_YEAR.equals("")||AddAnniActivity.DATE_MONTH.equals("")||AddAnniActivity.DATE_DAY.equals("")){
				textEventTime.setText("点击这里选择日期");
			}
			else{
				textEventTime.setText(AnniEditActivity.DATE_YEAR+"年"+AnniEditActivity.DATE_MONTH+"月"+AnniEditActivity.DATE_DAY+"日");
			}
		}
		if(requestCode==3&&resultCode==0){
			
			textRemind.setText(AddAnniActivity.FREQUENT);
		}
		
	}

	
	
}
<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;
import com.example.tinylove.View.PictureView.TransitionEffect;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class TimeSelectModeDialog extends Activity implements OnClickListener {
	
	private TextView[] textMode=new TextView[12];

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_time_select_mode);

		textMode[0]=(TextView)findViewById(R.id.mode_0);
		textMode[1]=(TextView)findViewById(R.id.mode_1);
		textMode[2]=(TextView)findViewById(R.id.mode_2);
		textMode[3]=(TextView)findViewById(R.id.mode_3);
		textMode[4]=(TextView)findViewById(R.id.mode_4);
		textMode[5]=(TextView)findViewById(R.id.mode_5);
		textMode[6]=(TextView)findViewById(R.id.mode_6);
		textMode[7]=(TextView)findViewById(R.id.mode_7);
		textMode[8]=(TextView)findViewById(R.id.mode_8);
		textMode[9]=(TextView)findViewById(R.id.mode_9);
		textMode[10]=(TextView)findViewById(R.id.mode_10);
		textMode[11]=(TextView)findViewById(R.id.mode_11);

		textMode[0].setOnClickListener(this);
		textMode[1].setOnClickListener(this);
		textMode[2].setOnClickListener(this);
		textMode[3].setOnClickListener(this);
		textMode[4].setOnClickListener(this);
		textMode[5].setOnClickListener(this);
		textMode[6].setOnClickListener(this);
		textMode[7].setOnClickListener(this);
		textMode[8].setOnClickListener(this);
		textMode[9].setOnClickListener(this);
		textMode[10].setOnClickListener(this);
		textMode[11].setOnClickListener(this);
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.mode_0:
			TimeFragment.effect=TransitionEffect.Standard;
			finish();
			break;
		case R.id.mode_1:
			TimeFragment.effect=TransitionEffect.Tablet;
			finish();
			break;
		case R.id.mode_2:
			TimeFragment.effect=TransitionEffect.CubeIn;
			finish();
			break;
		case R.id.mode_3:
			TimeFragment.effect=TransitionEffect.CubeOut;
			finish();
			break;
		case R.id.mode_4:
			TimeFragment.effect=TransitionEffect.FlipVertical;
			finish();
			break;
		case R.id.mode_5:
			TimeFragment.effect=TransitionEffect.FlipHorizontal;
			finish();
			break;
		case R.id.mode_6:
			TimeFragment.effect=TransitionEffect.Stack;
			finish();
			break;
		case R.id.mode_7:
			TimeFragment.effect=TransitionEffect.ZoomIn;
			finish();
			break;
		case R.id.mode_8:
			TimeFragment.effect=TransitionEffect.ZoomOut;
			finish();
			break;
		case R.id.mode_9:
			TimeFragment.effect=TransitionEffect.RotateUp;
			finish();
			break;
		case R.id.mode_10:
			TimeFragment.effect=TransitionEffect.RotateDown;
			finish();
			break;
		case R.id.mode_11:
			TimeFragment.effect=TransitionEffect.Accordion;
			finish();
			break;
		}
	}

}
<file_sep>package com.example.tinylove.Activity;

import java.util.LinkedList;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyCheck;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView.FindListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class CheckActivity extends Activity implements OnClickListener {
	
	private ImageView back;
	private CheckItem[] items=new CheckItem[8];
	
	public LinkedList<String> checkIDs;
	public LinkedList<Integer> checkStates;
	public LinkedList<Integer> checkTimess;
	public LinkedList<String> checkLastDays;
	
	private TinyCheck check;
	
	public static Activity activity;
	public static boolean detailIsChangeCheck;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_check);
		activity=this;
		
		get();
		
		initView();
		setOnListeners();
		
	}
	
	private void get(){
		check=new TinyCheck();
		check.getData(MainActivity.currentUser);
		checkIDs=check.getCids();
		checkStates=check.getCss();
		checkTimess=check.getCtss();
		checkLastDays=check.getClds();
		check.display();
	}

	private void initView() {
		// TODO Auto-generated method stub
		
		back=(ImageView)findViewById(R.id.check_back);
		
		for(int i=0;i<8;i++){
			int id=CheckItem.dataItemId[i];
			int id1=CheckItem.dataCheckOutId[i];
			int id2=CheckItem.dataCheckInImageId[i];
			int id3=CheckItem.dataCheckInSpace[i];
			int id4=CheckItem.dataCheckInNum[i];
			int id5=CheckItem.dataCheckInDay[i];
			items[i]=new CheckItem(id, id1, id2, id3, id4, id5);
			items[i].item=(RelativeLayout)findViewById(id);
			items[i].textCheckOut=(TextView)findViewById(id1);
			items[i].imageCheckIn=(ImageView)findViewById(id2);
			items[i].viewCheckInSpace=(View)findViewById(id3);
			items[i].textCheckInNum=(TextView)findViewById(id4);
			items[i].textCheckInDay=(TextView)findViewById(id5);
			
			if(check.isChecked(checkIDs.get(i))){
				items[i].textCheckOut.setVisibility(View.GONE);
				items[i].imageCheckIn.setVisibility(View.VISIBLE);
				items[i].viewCheckInSpace.setVisibility(View.VISIBLE);
				items[i].textCheckInNum.setVisibility(View.VISIBLE);
				items[i].textCheckInDay.setVisibility(View.VISIBLE);
				items[i].textCheckInNum.setText(checkTimess.get(i)+"");
			}
			else{
				items[i].textCheckOut.setVisibility(View.VISIBLE);
				items[i].imageCheckIn.setVisibility(View.GONE);
				items[i].viewCheckInSpace.setVisibility(View.GONE);
				items[i].textCheckInNum.setVisibility(View.GONE);
				items[i].textCheckInDay.setVisibility(View.GONE);
			}
		}
		
	}

	private void setOnListeners() {
		// TODO Auto-generated method stub
		back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		
		for(int i=0;i<8;i++){
			items[i].item.setOnClickListener(this);
			items[i].textCheckOut.setOnClickListener(this);
		}
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		for(int i=0;i<8;i++){
			if(v.getId()==items[i].id){
				CheckDetailDialog.checkID=checkIDs.get(i);
				CheckDetailDialog.checkId=i;
				if(check.isChecked(checkIDs.get(i))){
					CheckDetailDialog.isChecked=true;
				}
				else{
					CheckDetailDialog.isChecked=false;
				}
				CheckDetailDialog.checkDays=checkTimess.get(i);
				Intent intent=new Intent(CheckActivity.this, CheckDetailDialog.class);
				startActivityForResult(intent,5);
			}
			if(v.getId()==items[i].checkOutId){
				if(check.check(checkIDs.get(i))){
					items[i].textCheckOut.setVisibility(View.GONE);
					items[i].imageCheckIn.setVisibility(View.VISIBLE);
					items[i].viewCheckInSpace.setVisibility(View.VISIBLE);
					items[i].textCheckInNum.setVisibility(View.VISIBLE);
					items[i].textCheckInDay.setVisibility(View.VISIBLE);
					get();
					items[i].textCheckInNum.setText(checkTimess.get(i)+"");
				}
				else{
					PromptDialog.title="Error";
					PromptDialog.content="½ñÈÕÒÑ´ò¿¨";
					Intent ip=new Intent(CheckActivity.this, PromptDialog.class);
					startActivity(ip);
				}
				
			}
		}
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		
		if(requestCode==5&&resultCode==0){
			if(detailIsChangeCheck){
				Intent i=new Intent(CheckActivity.this, CheckActivity.class);
				startActivity(i);
				finish();
			}
		}
	}
	
	
	
}

class CheckItem{
	
	final static int[] dataItemId={R.id.check_morning,R.id.check_evening,R.id.check_phone,R.id.check_travel,
			R.id.check_food,R.id.check_movie,R.id.check_sport,R.id.check_shop};
	final static int[] dataCheckOutId={R.id.check_morning_out,R.id.check_evening_out,R.id.check_phone_out,
			R.id.check_travel_out,R.id.check_food_out,R.id.check_movie_out,R.id.check_sport_out,R.id.check_shop_out};
	final static int[] dataCheckInImageId={R.id.check_morning_in_image,R.id.check_evening_in_image,R.id.check_phone_in_image,
			R.id.check_travel_in_image,R.id.check_food_in_image,R.id.check_movie_in_image,R.id.check_sport_in_image,R.id.check_shop_in_image};
	final static int[] dataCheckInSpace={R.id.check_morning_in_space,R.id.check_evening_in_space,R.id.check_phone_in_space,
			R.id.check_travel_in_space,R.id.check_food_in_space,R.id.check_movie_in_space,R.id.check_sport_in_space,R.id.check_shop_in_space};
	final static int[] dataCheckInNum={R.id.check_morning_in_num,R.id.check_evening_in_num,R.id.check_phone_in_num,
			R.id.check_travel_in_num,R.id.check_food_in_num,R.id.check_movie_in_num,R.id.check_sport_in_num,R.id.check_shop_in_num};
	final static int[] dataCheckInDay={R.id.check_morning_in_day,R.id.check_evening_in_day,R.id.check_phone_in_day,
			R.id.check_travel_in_day,R.id.check_food_in_day,R.id.check_movie_in_day,R.id.check_sport_in_day,R.id.check_shop_in_day};

	final static int MORNING=0;
	final static int EVENING=1;
	final static int PHONE=2;
	final static int TRAVEL=3;
	final static int FOOD=4;
	final static int MOVIE=5;
	final static int SPORT=6;
	final static int SHOP=7;
	
	RelativeLayout item;
	int id;
	
	TextView textCheckOut;
	int checkOutId;
	
	ImageView imageCheckIn;
	int checkInImageId;
	
	View viewCheckInSpace;
	int checkInViewId;
	
	TextView textCheckInNum;
	int checkInTextNumId;
	
	TextView textCheckInDay;
	int checkInTextDayId;
	
	public CheckItem(int id,int id1,int id2,int id3,int id4,int id5){
		this.id=id;
		this.checkOutId=id1;
		this.checkInImageId=id2;
		this.checkInViewId=id3;
		this.checkInTextNumId=id4;
		this.checkInTextDayId=id5;
	}
	
}

<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyCheck;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class CheckDetailDialog extends Activity {
	
	final static int[] icon={R.drawable.checkin_morning,R.drawable.checkin_night,R.drawable.checkin_phone,R.drawable.checkin_travel,
			R.drawable.checkin_eat,R.drawable.checkin_movie,R.drawable.checkin_sport,R.drawable.checkin_shop};
	final static String[] content={"每天说早安","每天说晚安","煲一次电话粥","一起去旅行","一起去吃好吃的","一起去看电影","一起去健身","一起去购物"};
	
	private ImageView imageHead;
	private TextView textHead;
	
	private ImageView imageCheckState;
	private TextView textCheckState;
	
	private TextView textDays;
	
	public static String checkID="";
	public static int checkId=0;
	public static boolean isChecked=false;
	public static int checkDays=0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_check_detail);
		CheckActivity.detailIsChangeCheck=false;
		
		initView();
		setOnListeners();
		
	}

	private void initView() {
		// TODO Auto-generated method stub
		imageHead=(ImageView)findViewById(R.id.check_detail_image);
		textHead=(TextView)findViewById(R.id.check_detail_text);
		imageHead.setImageResource(icon[checkId]);
		textHead.setText(content[checkId]);
		
		imageCheckState=(ImageView)findViewById(R.id.check_detail_image_check);
		textCheckState=(TextView)findViewById(R.id.check_detail_text_state);
		
		textDays=(TextView)findViewById(R.id.checkin_detail_text_days);
		
		if(isChecked){
			imageCheckState.setImageResource(R.drawable.checkin_detail_state_done_icon);
			textCheckState.setText("今日已打卡");
		}
		else{
			imageCheckState.setImageResource(R.drawable.checkin_detail_state_not_icon);
			textCheckState.setText("点击打卡");
		}
		
		textDays.setText(checkDays+"");
		
		
	}

	private void setOnListeners() {
		// TODO Auto-generated method stub
		imageCheckState.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(!isChecked){
					TinyCheck check=new TinyCheck();
					if(check.check(checkID)){
						imageCheckState.setImageResource(R.drawable.checkin_detail_state_done_icon);
						textCheckState.setText("今日已打卡");
						textDays.setText((checkDays+1)+"");
						CheckActivity.detailIsChangeCheck=true;
					}
					else{
						Toast.makeText(CheckDetailDialog.this, "有问题！", Toast.LENGTH_SHORT).show();
					}
				}
				
			}
		});
	}
}
<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class AboutUsDialog extends Activity {
	
	public static String content="";
	
	private TextView textAboutUs;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_about_us);
		
		textAboutUs=(TextView)findViewById(R.id.about_us_content);
		
		textAboutUs.setText(content);
		
	}


}
<file_sep>package com.example.tinylove.Activity;

import java.util.LinkedList;

import com.example.tinylove.R;
import com.example.tinylove.Adapter.MyWishRecyclerAdapter;
import com.example.tinylove.Database.TinyWish;
import com.example.tinylove.Interface.ItemClickListener;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class WishActivity extends Activity {
	
	private ImageView back;
	private ImageView more;
	
	private RecyclerView wishList;
	private RecyclerView.LayoutManager layoutManage;
	private MyWishRecyclerAdapter adapter;
	
	public static Activity activity;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_wish);
		activity=this;
		initView();
		onSetListeners();
		
	}

	private LinkedList<String> wishIDs;
	private LinkedList<String> wishTimes;
	private LinkedList<String> wishContents;
	private LinkedList<Integer> wishStates;

	private void initView() {
		// TODO Auto-generated method stub
		back=(ImageView)findViewById(R.id.wish_back);
		more=(ImageView)findViewById(R.id.wish_more);
		
		wishList=(RecyclerView)findViewById(R.id.wish_recycler);
		wishList.setHasFixedSize(true);
		layoutManage=new LinearLayoutManager(WishActivity.this);
		wishList.setLayoutManager(layoutManage);
		
		TinyWish wish=new TinyWish();
		wish.getData(MainActivity.currentUser);
		wishIDs=wish.getWids();
		wishTimes=wish.getWts();
		wishContents=wish.getWcs();
		wishStates=wish.getWss();
		
		adapter=new MyWishRecyclerAdapter(wishContents, wishStates);
		wishList.setAdapter(adapter);
		
	}

	private void onSetListeners() {
		// TODO Auto-generated method stub
		back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				WishActivity.this.finish();
			}
		});
		
		more.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intentMore=new Intent(WishActivity.this, WishAddDialog.class);
				startActivity(intentMore);
			}
		});
		
		adapter.setOnClickListener(new ItemClickListener() {
			
			@Override
			public void onItemClickListener(int position) {
				// TODO Auto-generated method stub
				WishDetailDialog.wishID=wishIDs.get(position);
				WishDetailDialog.wishCon=wishContents.get(position);
				WishDetailDialog.wishTime=wishTimes.get(position);
				WishDetailDialog.wishState=wishStates.get(position);
				Intent intent=new Intent(WishActivity.this, WishDetailDialog.class);
				startActivity(intent);
			}
		});
	}

}
<file_sep>package com.example.tinylove.Activity;

import com.example.tinylove.R;
import com.example.tinylove.Database.TinyAnni;
import com.example.tinylove.Database.TinyUser;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends Activity {
	
	private EditText editName;
	private EditText editPsw;
	
	private Button btnLogin;
	
	public static String name="";
	private String psw="";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login);
		
		editName=(EditText)findViewById(R.id.login_name);
		editPsw=(EditText)findViewById(R.id.login_psw);
		btnLogin=(Button)findViewById(R.id.login_btn);
		
		btnLogin.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				name=editName.getText().toString();
				psw=editPsw.getText().toString();
				
				TinyUser user=new TinyUser();
				if(user.login(name, psw)){
					MainActivity.currentUser=user.userName;
					TinyAnni anni=new TinyAnni();
					HomepageFragment.DAY=anni.getDays(MainActivity.currentUser);
					
					GuideActivity.activity.finish();
					Intent intent=new Intent(LoginActivity.this, MainActivity.class);
					startActivity(intent);
					finish();
				}
				else{
					PromptDialog.title="Error";
					PromptDialog.content="用户名或者密码不正确！";
					Intent intentError=new Intent(LoginActivity.this,PromptDialog.class);
					startActivity(intentError);
				}
			}
		});
		
	}

}
<file_sep>package com.example.tinylove.Adapter;

import java.util.List;

import android.app.Activity;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

public class MyViewPagerAdapter extends PagerAdapter{
	
	private List<View> views;
	private Activity activity;
	
	private static final String SHAREDPREFERENCES_NAME = "first_pref";
	
	public MyViewPagerAdapter(List<View> views,Activity activity) {
		// TODO Auto-generated constructor stub
		this.views=views;
		this.activity=activity;
	}
	
	//初始化arg1位置的界面
	@Override
	public Object instantiateItem(View arg0, int arg1) {
		// TODO Auto-generated method stub
		((ViewPager)arg0).addView(views.get(arg1), 0);
		return views.get(arg1);
	}
	
	//销毁arg1位置的界面
	@Override
	public void destroyItem(View arg0, int arg1, Object arg2) {
		// TODO Auto-generated method stub
		((ViewPager)arg0).removeView(views.get(arg1));
	}

	//判断是否由对象生成界面
	@Override
	public boolean isViewFromObject(View arg0,Object arg1){
		return (arg0==arg1);
	}

	//获取页面数
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if(views!=null){
			return views.size();
		}
		
		return 0;
	}

	@Override
	public void finishUpdate(View container) {
		// TODO Auto-generated method stub
	}

	@Override
	public void restoreState(Parcelable state, ClassLoader loader) {
		// TODO Auto-generated method stub
	}

	@Override
	public Parcelable saveState() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void startUpdate(View container) {
		// TODO Auto-generated method stub
	}
	
	
	

}
