diff --git a/Soft1606070302235/AndroidManifest.xml b/Soft1606070302235/AndroidManifest.xml deleted file mode 100644 index 7865b92ba..000000000 --- a/Soft1606070302235/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Soft1606070302235/Soft1606070302235Activity.java b/Soft1606070302235/Soft1606070302235Activity.java deleted file mode 100644 index ef4914d13..000000000 --- a/Soft1606070302235/Soft1606070302235Activity.java +++ /dev/null @@ -1,5 +0,0 @@ -package edu.hzuapps.androidlabs.soft1606070302235; - -public class Soft1606070302235Activity{ - -} \ No newline at end of file diff --git a/Soft1606070302235/iBook.apk b/Soft1606070302235/iBook.apk deleted file mode 100644 index b1672a44d..000000000 Binary files a/Soft1606070302235/iBook.apk and /dev/null differ diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/SecondActivity.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/SecondActivity.java deleted file mode 100644 index 763cc5769..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/SecondActivity.java +++ /dev/null @@ -1,151 +0,0 @@ -package edu.hzuapps.androidlabs.soft1606070302235; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -import com.example.beans.Cuns; -import com.example.luoji.MyDataBase; -import com.example.luoji.MyOpenHelper; - -import android.os.Bundle; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.database.sqlite.SQLiteDatabase; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -/* - *用来编辑日记 - *主要包括一个方法,isSave()用来保存数据; - */ -public class SecondActivity extends Activity { - - EditText ed1,ed2; - Button bt1; - MyDataBase myDatabase; - Cuns cun; - int ids; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_second); - ed1=(EditText) findViewById(R.id.editText1); - ed2=(EditText) findViewById(R.id.editText2); - bt1=(Button) findViewById(R.id.button1); - myDatabase=new MyDataBase(this); - - Intent intent=this.getIntent(); - ids=intent.getIntExtra("ids", 0); - //默认为0,不为0,则为修改数据时跳转过来的 - if(ids!=0){ - cun=myDatabase.getTiandCon(ids); - ed1.setText(cun.getTitle()); - ed2.setText(cun.getContent()); - } - //保存按钮的点击事件,他和返回按钮是一样的功能,所以都调用isSave()方法; - bt1.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - // TODO Auto-generated method stub - isSave(); - } - }); - } - /* - * 返回按钮调用的方法。 - * @see android.app.Activity#onBackPressed() - */ - @Override - public void onBackPressed() { - // TODO Auto-generated method stub - //super.onBackPressed(); - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd HH:mm:ss"); - Date curDate = new Date(System.currentTimeMillis());//获取当前时间 - String times = formatter.format(curDate); - String title=ed1.getText().toString(); - String content=ed2.getText().toString(); - //是要修改数据 - if(ids!=0){ - cun=new Cuns(title,ids, content, times); - myDatabase.toUpdate(cun); - Intent intent=new Intent(SecondActivity.this,Soft1606070302235Activity.class); - startActivity(intent); - SecondActivity.this.finish(); - } - //新建日记 - else{ - if(title.equals("")&&content.equals("")){ - Intent intent=new Intent(SecondActivity.this,Soft1606070302235Activity.class); - startActivity(intent); - SecondActivity.this.finish(); - } - else{ - cun=new Cuns(title,content,times); - myDatabase.toInsert(cun); - Intent intent=new Intent(SecondActivity.this,Soft1606070302235Activity.class); - startActivity(intent); - SecondActivity.this.finish(); - } - - } - } - private void isSave(){ - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd HH:mm:ss"); - Date curDate = new Date(System.currentTimeMillis());//获取当前时间 - String times = formatter.format(curDate); - String title=ed1.getText().toString(); - String content=ed2.getText().toString(); - //是要修改数据 - if(ids!=0){ - cun=new Cuns(title,ids, content, times); - myDatabase.toUpdate(cun); - Intent intent=new Intent(SecondActivity.this,Soft1606070302235Activity.class); - startActivity(intent); - SecondActivity.this.finish(); - } - //新建日记 - else{ - cun=new Cuns(title,content,times); - myDatabase.toInsert(cun); - Intent intent=new Intent(SecondActivity.this,Soft1606070302235Activity.class); - startActivity(intent); - SecondActivity.this.finish(); - } - } - - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.second_activity, menu); - return true; - } - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // TODO Auto-generated method stub - switch (item.getItemId()) { - case R.id.action_settings: - Intent intent=new Intent(Intent.ACTION_SEND); - intent.setType("text/plain"); - intent.putExtra(Intent.EXTRA_TEXT, "标题:"+ed1.getText().toString()+" 内容:"+ed2.getText().toString()); - startActivity(intent); - break; - - default: - break; - } - return false; - } - - -} - diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/Soft1606070302235Activity.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/Soft1606070302235Activity.java deleted file mode 100644 index 08b5b5573..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/Soft1606070302235/Soft1606070302235Activity.java +++ /dev/null @@ -1,149 +0,0 @@ -package edu.hzuapps.androidlabs.soft1606070302235; -import java.util.ArrayList; - -import com.example.beans.Cuns; -import com.example.luoji.MyAdapter; -import com.example.luoji.MyDataBase; - -import android.os.Bundle; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.View.OnLongClickListener; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.AdapterView.OnItemLongClickListener; -import android.widget.Button; -import android.widget.ListView; - -/* - * 这个类主要包括五个点击事件,分别为 - * 1,ListView的长按点击事件,用来AlertDialog来判断是否删除数据。 - * 2,ListView的点击事件,跳转到第二个界面,用来修改数据 - * 3,新建便签按钮的点击事件,跳转到第二界面,用来新建便签 - * 4,menu里的退出事件,用来退出程序 - * 5,menu里的新建事件,用来新建便签 - */ -public class Soft1606070302235Activity extends Activity { - - Button bt; - ListView lv; - LayoutInflater inflater; - ArrayList array; - MyDataBase mdb; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_soft1606070302235); - - lv=(ListView) findViewById(R.id.listView1); - bt=(Button) findViewById(R.id.button1); - inflater=getLayoutInflater(); - - mdb=new MyDataBase(this); - array=mdb.getArray(); - MyAdapter adapter=new MyAdapter(inflater,array); - lv.setAdapter(adapter); - /* - * 点击listView里面的item,进入到第二个页面,用来修改日记 - */ - lv.setOnItemClickListener(new OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, - int position, long id) { - // TODO Auto-generated method stub - Intent intent=new Intent(getApplicationContext(),SecondActivity.class); - intent.putExtra("ids",array.get(position).getIds() ); - startActivity(intent); - Soft1606070302235Activity.this.finish(); - } - }); - /* - * 长点后来判断是否删除数据 - */ - lv.setOnItemLongClickListener(new OnItemLongClickListener() { - - @Override - public boolean onItemLongClick(AdapterView parent, View view, - final int position, long id) { - // TODO Auto-generated method stub - //AlertDialog,来判断是否删除日记。 - new AlertDialog.Builder(Soft1606070302235Activity.this) - .setTitle("删除") - .setMessage("是否删除笔记") - .setNegativeButton("取消", new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - // TODO Auto-generated method stub - - } - }) - .setPositiveButton("确定", new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - // TODO Auto-generated method stub - mdb.toDelete(array.get(position).getIds()); - array=mdb.getArray(); - MyAdapter adapter=new MyAdapter(inflater,array); - lv.setAdapter(adapter); - } - }) - .create().show(); - return true; - } - }); - /* - * 按钮点击事件,用来新建日记 - */ - bt.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - // TODO Auto-generated method stub - Intent intent=new Intent(getApplicationContext(),SecondActivity.class); - startActivity(intent); - Soft1606070302235Activity.this.finish(); - } - }); - - - - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // TODO Auto-generated method stub - switch (item.getItemId()) { - case R.id.item1: - Intent intent=new Intent(getApplicationContext(),SecondActivity.class); - startActivity(intent); - this.finish(); - break; - case R.id.item2: - this.finish(); - break; - default: - break; - } - return true; - - } - - -} - diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/beans/Cuns.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/beans/Cuns.java deleted file mode 100644 index 5a8d3c72a..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/beans/Cuns.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.example.beans; -/* - * ������ʱ�洢���� - */ -public class Cuns { - private String title;//���� - private String content;//���� - private String times;//ʱ�� - private int ids;//��� - public Cuns(String ti,int id,String con ,String time){ - this.ids=id; - this.title=ti; - this.content=con; - this.times=time; - } - public Cuns(String ti,String con,String time){ - this.title=ti; - this.content=con; - this.times=time; - } - public Cuns(int i,String ti,String time){ - this.ids=i; - this.title=ti; - this.times=time; - } - public Cuns(String ti,String con){ - this.title=ti; - this.content=con; - } -public int getIds() { - return ids; -} -public String getTitle() { - return title; -} -public String getContent() { - return content; -} -public String getTimes() { - return times; -} - -} diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyAdapter.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyAdapter.java deleted file mode 100644 index 409d5b953..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.example.luoji; - -import java.util.ArrayList; - -import com.example.beans.Cuns; -import com.example.ibook.R; - - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -/* - * �������ListView,��γɹ�����������ҳ����룬ֻҪ����������ֵ��inflater ,������ArrayList<>; - */ -public class MyAdapter extends BaseAdapter{ - - LayoutInflater inflater; - ArrayList array; - public MyAdapter(LayoutInflater inf,ArrayList arry){ - this.inflater=inf; - this.array=arry; - } - @Override - public int getCount() { - // TODO Auto-generated method stub - return array.size(); - } - - @Override - public Object getItem(int position) { - // TODO Auto-generated method stub - return array.get(position); - } - - @Override - public long getItemId(int position) { - // TODO Auto-generated method stub - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - // TODO Auto-generated method stub - ViewHolder vh; - if(convertView==null){ - vh=new ViewHolder(); - convertView=inflater.inflate(R.layout.adapter_listview, null);//ע�⵼������ϵͳ�� - vh.tv1=(TextView) convertView.findViewById(R.id.textView1); - vh.tv2=(TextView) convertView.findViewById(R.id.textView2); - convertView.setTag(vh); - } - vh=(ViewHolder) convertView.getTag(); - vh.tv1.setText(array.get(position).getTitle()); - vh.tv2.setText(array.get(position).getTimes()); - return convertView; - } - class ViewHolder{ - TextView tv1,tv2; - } -} diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyDataBase.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyDataBase.java deleted file mode 100644 index 39bd944a8..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyDataBase.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.example.luoji; - -import java.util.ArrayList; - -import com.example.beans.Cuns; - -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -/* - * ר���������ݿ�������࣬�����Ľ����Ƿdz���ȷ�ģ������е����ݿ�������ŵ���������������ֱ�ӵ��þͺ��ˡ� - * ���ݵ�����ɾ���ģ��飬��������ʵ�� - */ -public class MyDataBase { - Context context; - MyOpenHelper myHelper; - SQLiteDatabase myDatabase; - /* - * �����ʵ����������ͬʱ���������ݿ� - */ - public MyDataBase(Context con){ - this.context=con; - myHelper=new MyOpenHelper(context); - } - /* - * �õ����ListView�õ�array���ݣ������ݿ�����Һ��������һ��������� - */ - public ArrayList getArray(){ - ArrayList array=new ArrayList(); - ArrayList array1=new ArrayList(); - myDatabase=myHelper.getWritableDatabase(); - Cursor cursor=myDatabase.rawQuery("select ids,title,times from mybook" , null); - cursor.moveToFirst(); - while(!cursor.isAfterLast()){ - int id=cursor.getInt(cursor.getColumnIndex("ids")); - String title=cursor.getString(cursor.getColumnIndex("title")); - String times=cursor.getString(cursor.getColumnIndex("times")); - Cuns cun=new Cuns(id, title, times); - array.add(cun); - cursor.moveToNext(); - } - myDatabase.close(); - for (int i = array.size(); i >0; i--) { - array1.add(array.get(i-1)); - } - return array1; - } - - /* - * ���ؿ���Ҫ�޸ĵ����ݣ��ڶ���������á� - */ - public Cuns getTiandCon(int id){ - myDatabase=myHelper.getWritableDatabase(); - Cursor cursor=myDatabase.rawQuery("select title,content from mybook where ids='"+id+"'" , null); - cursor.moveToFirst(); - String title=cursor.getString(cursor.getColumnIndex("title")); - String content=cursor.getString(cursor.getColumnIndex("content")); - Cuns cun=new Cuns(title,content); - myDatabase.close(); - return cun; - } - /* - * �ڶ���������ã������޸��ռ� - */ - public void toUpdate(Cuns cun){ - myDatabase=myHelper.getWritableDatabase(); - myDatabase.execSQL("update mybook set title='"+ cun.getTitle()+"',times='"+cun.getTimes()+"',content='"+cun.getContent() +"' where ids='"+ cun.getIds()+"'"); - myDatabase.close(); - } - /* - *�ڶ���������ã����������µ��ռ� - */ - public void toInsert(Cuns cun){ - myDatabase=myHelper.getWritableDatabase(); - myDatabase.execSQL("insert into mybook(title,content,times)values('"+ cun.getTitle()+"','"+cun.getContent()+"','"+cun.getTimes()+"')"); - myDatabase.close(); - } - /* - * ��һ��������ã����������ѡ��ɾ���ռ� - */ - public void toDelete(int ids){ - myDatabase=myHelper.getWritableDatabase(); - myDatabase.execSQL("delete from mybook where ids="+ids+""); - myDatabase.close(); - } -} diff --git a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyOpenHelper.java b/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyOpenHelper.java deleted file mode 100644 index 3b7fbb541..000000000 --- a/Soft1606070302235/java/edu/hzuapps/androidlabs/luoji/MyOpenHelper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.example.luoji; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteDatabase.CursorFactory; -import android.database.sqlite.SQLiteOpenHelper; - -/* - * ��д��SQLiteOpenHelper�࣬�����������ݿ⣬���б����Լ���Ӧ�úú�ѧϰһ�¡� - */ -public class MyOpenHelper extends SQLiteOpenHelper{ - - public MyOpenHelper(Context context) { - super(context, "mydate", null, 1); - // TODO Auto-generated constructor stub - } - - @Override - public void onCreate(SQLiteDatabase db) { - // TODO Auto-generated method stub - db.execSQL("create table mybook(ids integer PRIMARY KEY autoincrement,title text,content text,times text)"); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - // TODO Auto-generated method stub - - } - - -} diff --git a/Soft1606070302235/res/drawable-v24/ic_launcher_foreground.xml b/Soft1606070302235/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index c7bd21dbd..000000000 --- a/Soft1606070302235/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - diff --git a/Soft1606070302235/res/drawable/btnselector.xml b/Soft1606070302235/res/drawable/btnselector.xml deleted file mode 100644 index 1d1103b5d..000000000 --- a/Soft1606070302235/res/drawable/btnselector.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/Soft1606070302235/res/drawable/ic_launcher_background.xml b/Soft1606070302235/res/drawable/ic_launcher_background.xml deleted file mode 100644 index d5fccc538..000000000 --- a/Soft1606070302235/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Soft1606070302235/res/drawable/icon_app.png b/Soft1606070302235/res/drawable/icon_app.png deleted file mode 100644 index 418aadc70..000000000 Binary files a/Soft1606070302235/res/drawable/icon_app.png and /dev/null differ diff --git a/Soft1606070302235/res/drawable/new_note_normal.png b/Soft1606070302235/res/drawable/new_note_normal.png deleted file mode 100644 index 40e3b8e0e..000000000 Binary files a/Soft1606070302235/res/drawable/new_note_normal.png and /dev/null differ diff --git a/Soft1606070302235/res/drawable/new_note_pressed.png b/Soft1606070302235/res/drawable/new_note_pressed.png deleted file mode 100644 index c7489362c..000000000 Binary files a/Soft1606070302235/res/drawable/new_note_pressed.png and /dev/null differ diff --git a/Soft1606070302235/res/layout/activity_second.xml b/Soft1606070302235/res/layout/activity_second.xml deleted file mode 100644 index 7970448cd..000000000 --- a/Soft1606070302235/res/layout/activity_second.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - -