first
This commit is contained in:
commit
6cd146c8cf
|
@ -0,0 +1,8 @@
|
|||
# 倒数日
|
||||
事件倒数日计算
|
||||
|
||||

|
||||
|
||||
## 参考
|
||||
[制作半圆背景](https://www.shuzhiduo.com/A/B0zqGV35vL/)
|
||||
[ListView设置选中状态](https://blog.csdn.net/ws_lm/article/details/53764008)
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hty.daycount"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.Holo.Light">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,73 @@
|
|||
package com.hty.daycount;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class DBHelper extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "event.db";
|
||||
private final static int VERSION = 1;
|
||||
static String TableName = "event";
|
||||
private SQLiteDatabase db;
|
||||
private static DBHelper mInstance = null;
|
||||
|
||||
public DBHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, VERSION);
|
||||
}
|
||||
|
||||
public static synchronized DBHelper getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new DBHelper(context);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
this.db = db;
|
||||
db.execSQL("CREATE TABLE "+ TableName + " (_id INTEGER PRIMARY KEY , time INTEGER, event TEXT)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
// db.execSQL("DROP TABLE IF EXISTS battery");
|
||||
// onCreate(db);
|
||||
switch (newVersion) {
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void insert(ContentValues values) {
|
||||
db = getWritableDatabase();
|
||||
db.insert(TableName, null, values);
|
||||
db.close();
|
||||
}
|
||||
|
||||
public Cursor query(String s) {
|
||||
db = getWritableDatabase();
|
||||
Cursor c;
|
||||
if (s.equals("")) {
|
||||
c = db.query(TableName, null, null, null, null, null, "time desc");
|
||||
} else {
|
||||
c = db.query(TableName, null, "event LIKE '%" + s + "%'", null, null, null, "time desc");
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public void del(String id) {
|
||||
if (db == null)
|
||||
db = getWritableDatabase();
|
||||
db.delete(TableName, "_id=?", new String[] { id });
|
||||
// Log.e("id", id + "");
|
||||
// db.ExecuteNonQuery(CommandType.Text, "VACUUM");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (db != null)
|
||||
db.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,356 @@
|
|||
package com.hty.daycount;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.SearchManager;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
TextView textView_event1, textView_date, textView_count1, textView_day1;
|
||||
ListView listView;
|
||||
SimpleCursorAdapter adapter;
|
||||
InputMethodManager IMM;
|
||||
SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd E", Locale.getDefault());
|
||||
int position1 = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
textView_event1 = (TextView) findViewById(R.id.textView_event1);
|
||||
textView_date = (TextView) findViewById(R.id.textView_date);
|
||||
textView_count1 = (TextView) findViewById(R.id.textView_count1);
|
||||
textView_day1 = (TextView) findViewById(R.id.textView_day1);
|
||||
Date date = new Date();
|
||||
textView_date.setText(SDF.format(date));
|
||||
listView = (ListView) findViewById(R.id.listView);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
search("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
String[] sm = { "刷新", "添加", "更新日志", "关于", "退出" };
|
||||
for (int i=0; i<sm.length; i++) {
|
||||
menu.add(0, i, i, sm[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int item_id = item.getItemId();
|
||||
switch (item_id) {
|
||||
case 0:
|
||||
search("");
|
||||
textView_event1.setText("今天");
|
||||
Date date = new Date();
|
||||
textView_date.setText(SDF.format(date));
|
||||
textView_count1.setText("0");
|
||||
textView_count1.setTextColor(0xff000000);
|
||||
textView_day1.setBackgroundColor(0x00ff0000);
|
||||
break;
|
||||
case 1:
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(this);
|
||||
View view = layoutInflater.inflate(R.layout.event_edit, null);
|
||||
final EditText editText_event = (EditText) view.findViewById(R.id.editText_event);
|
||||
final DatePicker datePicker = (DatePicker) view.findViewById(R.id.datePicker);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setIcon(android.R.drawable.ic_menu_add);
|
||||
builder.setTitle("添加事件");
|
||||
builder.setView(view);
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int year = datePicker.getYear();
|
||||
int month = datePicker.getMonth();
|
||||
int day = datePicker.getDayOfMonth();
|
||||
Date date = new Date(year - 1900, month, day);
|
||||
String sdate = SDF.format(date);
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", sdate);
|
||||
String event = editText_event.getText().toString();
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
if (!event.equals("")) {
|
||||
DBHelper dbHelper = new DBHelper(getApplicationContext());
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("time", date.getTime());
|
||||
values.put("event", event);
|
||||
dbHelper.insert(values);
|
||||
search("");
|
||||
try {
|
||||
//关闭
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} else {
|
||||
if (event.equals("")){
|
||||
editText_event.setError("事件不能为空!");
|
||||
}
|
||||
try {
|
||||
//设置dialog不可关闭
|
||||
field.set(dialog, false);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
IMM.hideSoftInputFromWindow(editText_event.getWindowToken(), 0);
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
break;
|
||||
case 2:
|
||||
new AlertDialog.Builder(this)
|
||||
.setIcon(R.mipmap.ic_launcher)
|
||||
.setTitle("更新日志")
|
||||
.setMessage("V1.0 (2023-05)\n显示事件倒数日期。")
|
||||
.setPositiveButton("确定", null).show();
|
||||
break;
|
||||
case 3:
|
||||
new AlertDialog.Builder(this).setIcon(R.mipmap.ic_launcher).setTitle("倒数日 V1.0")
|
||||
.setMessage("显示事件倒数日期。\n作者:海天鹰\nQQ:84429027\n参考:Days Matter")
|
||||
.setPositiveButton("确定", null).show();
|
||||
break;
|
||||
case 4:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void search(String s) {
|
||||
DBHelper helper = new DBHelper(this);
|
||||
Cursor cursor1 = helper.query(s);
|
||||
int count = cursor1.getCount();
|
||||
setTitle("倒数日" + count);
|
||||
String[] from = { "_id", "time", "event", "time", "time" };
|
||||
int[] to = { R.id.textView_id, R.id.textView_time, R.id.textView_event, R.id.textView_count, R.id.textView_day };
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.item_event, cursor1, from, to, 0);
|
||||
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
|
||||
public boolean setViewValue(View view, Cursor cursor, int columnIndex){
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", view.toString() + columnIndex);
|
||||
if (view.getId() == R.id.textView_count) {
|
||||
Date date = new Date(cursor.getLong(columnIndex));
|
||||
Date date1 = new Date();
|
||||
long ms = date.getTime() - date1.getTime();
|
||||
long d = ms / 1000 / 60 / 60 / 24;
|
||||
if (ms >= 0)
|
||||
view.setBackgroundResource(R.drawable.count_bg);
|
||||
else
|
||||
view.setBackgroundResource(R.drawable.count_bg1);
|
||||
((TextView)view).setText(Math.abs(d) + "");
|
||||
return true;
|
||||
} else if (view.getId() == R.id.textView_day) {
|
||||
Date date = new Date(cursor.getLong(columnIndex));
|
||||
Date date1 = new Date();
|
||||
long ms = date.getTime() - date1.getTime();
|
||||
if (ms >= 0)
|
||||
view.setBackgroundResource(R.drawable.day_bg);
|
||||
else
|
||||
view.setBackgroundResource(R.drawable.day_bg1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
String event = ((TextView) view.findViewById(R.id.textView_event)).getText().toString();
|
||||
String stime = ((TextView) view.findViewById(R.id.textView_time)).getText().toString();
|
||||
String count = ((TextView) view.findViewById(R.id.textView_count)).getText().toString();
|
||||
Date date = new Date(Long.parseLong(stime));
|
||||
Date date1 = new Date();
|
||||
long ms = date.getTime() - date1.getTime();
|
||||
long d = ms / 1000 / 60 / 60 / 24;
|
||||
if (ms >= 0)
|
||||
textView_count1.setTextColor(0xff00bfff);
|
||||
else
|
||||
textView_count1.setTextColor(0xffffa500);
|
||||
if (ms >= 0 && d <= 5)
|
||||
textView_day1.setBackgroundColor(0xffff0000);
|
||||
else
|
||||
textView_day1.setBackgroundColor(0x00ff0000);
|
||||
textView_event1.setText(event);
|
||||
textView_date.setText(SDF.format(date));
|
||||
textView_count1.setText(count);
|
||||
}
|
||||
});
|
||||
listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
//AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||
//String title = ((TextView) info.targetView.findViewById(R.id.title)).getText().toString();
|
||||
//menu.setHeaderTitle(title);
|
||||
String[] sm = { "搜索", "修改", "删除" };
|
||||
for (int i=0; i<sm.length; i++) {
|
||||
menu.add(0, i, i, sm[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
|
||||
final String sid = ((TextView) menuInfo.targetView.findViewById(R.id.textView_id)).getText().toString();
|
||||
String time = ((TextView) menuInfo.targetView.findViewById(R.id.textView_time)).getText().toString();
|
||||
Date date = new Date(Long.parseLong(time));
|
||||
String event = ((TextView) menuInfo.targetView.findViewById(R.id.textView_event)).getText().toString();
|
||||
position1 = menuInfo.position;
|
||||
switch (item.getItemId()) {
|
||||
case 0:
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_WEB_SEARCH);
|
||||
intent.putExtra(SearchManager.QUERY, event);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case 1:
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(this);
|
||||
View view = layoutInflater.inflate(R.layout.event_edit, null);
|
||||
final EditText editText_event = (EditText) view.findViewById(R.id.editText_event);
|
||||
final DatePicker datePicker = (DatePicker) view.findViewById(R.id.datePicker);
|
||||
datePicker.init(date.getYear() + 1900, date.getMonth(), date.getDate(), null);
|
||||
editText_event.setText(event);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setIcon(android.R.drawable.ic_menu_edit);
|
||||
builder.setTitle("修改事件");
|
||||
builder.setView(view);
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String event = editText_event.getText().toString();
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
if (!event.equals("")) {
|
||||
int year = datePicker.getYear();
|
||||
int month = datePicker.getMonth();
|
||||
int day = datePicker.getDayOfMonth();
|
||||
Date date = new Date(year - 1900, month, day);
|
||||
DBHelper dbHelper = new DBHelper(getApplicationContext());
|
||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("time", date.getTime());
|
||||
values.put("event", event);
|
||||
db.update(DBHelper.TableName, values, "_id = " + sid, null);
|
||||
search("");
|
||||
listView.setSelection(position1);
|
||||
IMM.hideSoftInputFromWindow(editText_event.getWindowToken(), 0);
|
||||
try {
|
||||
//关闭
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} else {
|
||||
if (event.equals("")){
|
||||
editText_event.setError("事件不能为空!");
|
||||
}
|
||||
try {
|
||||
//设置dialog不可关闭
|
||||
field.set(dialog, false);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
break;
|
||||
case 2:
|
||||
new AlertDialog.Builder(MainActivity.this)
|
||||
.setIcon(android.R.drawable.stat_sys_warning)
|
||||
.setTitle("删除操作")
|
||||
.setMessage("此步骤不可还原,确定删除" + sid + "?\n" + SDF.format(date) + "\n" + event)
|
||||
.setPositiveButton("是", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
DBHelper dbHelper = new DBHelper(getApplicationContext());
|
||||
dbHelper.del(sid);
|
||||
search("");
|
||||
listView.setSelection(position1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("否", null)
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<solid android:color="#00bfff" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<solid android:color="#ffa500" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:right="2dp" android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#1e90ff" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:top="2dp" android:bottom="2dp" android:right="10dp">
|
||||
<shape>
|
||||
<solid android:color="#1e90ff" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:right="2dp" android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#ff6600" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:top="2dp" android:bottom="2dp" android:right="10dp" >
|
||||
<shape>
|
||||
<solid android:color="#ff6600" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:left="2dp" android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#ffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:left="10dp" android:top="2dp" android:bottom="2dp">
|
||||
<shape>
|
||||
<solid android:color="#ffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,4 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:drawable="@drawable/item_bg1"/>
|
||||
<item android:drawable="@drawable/item_bg"/>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#f3f3f3" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#0000ff" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:background="#fff"
|
||||
android:paddingLeft="10sp"
|
||||
android:paddingRight="10sp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_event1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:maxLines="1"
|
||||
android:text="今天"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:maxLines="1"
|
||||
android:singleLine="false"
|
||||
android:text="YYYY-MM-DD ddd" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_count1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="right"
|
||||
android:text="0"
|
||||
android:textSize="50sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_day1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="3sp"
|
||||
android:text="天" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#eee"
|
||||
android:divider="#eee"
|
||||
android:dividerHeight="5dp"
|
||||
android:padding="10sp">
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_event"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<DatePicker
|
||||
android:id="@+id/datePicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:calendarViewShown="false" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_event"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:gravity="start|top"
|
||||
android:hint="事件"
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/item_activated">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="id"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_event"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:background="@drawable/event_bg"
|
||||
android:padding="5sp"
|
||||
android:text="事件"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_count"
|
||||
android:layout_width="60sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="5sp"
|
||||
android:text="N"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="7sp"
|
||||
android:paddingRight="7sp"
|
||||
android:text="天"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="background_holo_light">#f3f3f3</color>
|
||||
</resources>
|
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<string name="app_name">倒数日</string>
|
||||
</resources>
|
Binary file not shown.
After Width: | Height: | Size: 149 KiB |
Loading…
Reference in New Issue