commit
3c9051c89c
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.micode.notes.ui;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import net.micode.notes.R;
|
||||||
|
import net.micode.notes.ui.DateTimePicker;
|
||||||
|
import net.micode.notes.ui.DateTimePicker.OnDateTimeChangedListener;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
|
||||||
|
public class DateTimePickerDialog extends AlertDialog implements OnClickListener {
|
||||||
|
|
||||||
|
private Calendar mDate = Calendar.getInstance();
|
||||||
|
private boolean mIs24HourView;
|
||||||
|
private OnDateTimeSetListener mOnDateTimeSetListener;
|
||||||
|
private DateTimePicker mDateTimePicker;
|
||||||
|
|
||||||
|
public interface OnDateTimeSetListener {
|
||||||
|
void OnDateTimeSet(AlertDialog dialog, long date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimePickerDialog(Context context, long date) {
|
||||||
|
super(context);
|
||||||
|
mDateTimePicker = new DateTimePicker(context);
|
||||||
|
setView(mDateTimePicker);
|
||||||
|
mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() {
|
||||||
|
public void onDateTimeChanged(DateTimePicker view, int year, int month,
|
||||||
|
int dayOfMonth, int hourOfDay, int minute) {
|
||||||
|
mDate.set(Calendar.YEAR, year);
|
||||||
|
mDate.set(Calendar.MONTH, month);
|
||||||
|
mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||||
|
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
|
||||||
|
mDate.set(Calendar.MINUTE, minute);
|
||||||
|
updateTitle(mDate.getTimeInMillis());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mDate.setTimeInMillis(date);
|
||||||
|
mDate.set(Calendar.SECOND, 0);
|
||||||
|
mDateTimePicker.setCurrentDate(mDate.getTimeInMillis());
|
||||||
|
setButton(context.getString(R.string.datetime_dialog_ok), this);
|
||||||
|
setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null);
|
||||||
|
set24HourView(DateFormat.is24HourFormat(this.getContext()));
|
||||||
|
updateTitle(mDate.getTimeInMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set24HourView(boolean is24HourView) {
|
||||||
|
mIs24HourView = is24HourView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
|
||||||
|
mOnDateTimeSetListener = callBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTitle(long date) {
|
||||||
|
int flag =
|
||||||
|
DateUtils.FORMAT_SHOW_YEAR |
|
||||||
|
DateUtils.FORMAT_SHOW_DATE |
|
||||||
|
DateUtils.FORMAT_SHOW_TIME;
|
||||||
|
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
|
||||||
|
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
|
if (mOnDateTimeSetListener != null) {
|
||||||
|
mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.micode.notes.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
|
import android.widget.PopupMenu.OnMenuItemClickListener;
|
||||||
|
|
||||||
|
import net.micode.notes.R;
|
||||||
|
|
||||||
|
public class DropdownMenu {
|
||||||
|
private Button mButton;
|
||||||
|
private PopupMenu mPopupMenu;
|
||||||
|
private Menu mMenu;
|
||||||
|
|
||||||
|
public DropdownMenu(Context context, Button button, int menuId) {
|
||||||
|
mButton = button;
|
||||||
|
mButton.setBackgroundResource(R.drawable.dropdown_icon);
|
||||||
|
mPopupMenu = new PopupMenu(context, mButton);
|
||||||
|
mMenu = mPopupMenu.getMenu();
|
||||||
|
mPopupMenu.getMenuInflater().inflate(menuId, mMenu);
|
||||||
|
mButton.setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mPopupMenu.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) {
|
||||||
|
if (mPopupMenu != null) {
|
||||||
|
mPopupMenu.setOnMenuItemClickListener(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MenuItem findItem(int id) {
|
||||||
|
return mMenu.findItem(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(CharSequence title) {
|
||||||
|
mButton.setText(title);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
#端口号配置
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
#数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/student?characterEncoding=UTF-8&serverTimezone=UTC
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
#mybatis相关配置
|
||||||
|
mybatis:
|
||||||
|
#配置MyBatis的xml配置文件路径
|
||||||
|
mapper-locations: classpath:com/uos/page/mapper/*.xml
|
||||||
|
#配置XML映射文件中指定的实体类别名路径
|
||||||
|
type-aliases-package: com.uos.page.domain
|
||||||
|
#开启驼峰命名
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>图片显示</title>
|
||||||
|
<style>
|
||||||
|
#upload-tip{
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
width: 135px;
|
||||||
|
height: 135px;
|
||||||
|
line-height: 135px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 36px;
|
||||||
|
color:#d9d9d9;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#img-show{
|
||||||
|
width: 135px;
|
||||||
|
height: 135px;
|
||||||
|
display: block;
|
||||||
|
/*margin: 0 auto;*/
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<label>
|
||||||
|
<span>印象图片:</span>
|
||||||
|
<div style="text-align: left;width: 135px;height: 135px;">
|
||||||
|
<div id="upload-tip" style="text-align: center">+</div>
|
||||||
|
<img src="" alt="" id="img-show" style="display: none">
|
||||||
|
<input type="file" id="imgfile" style="display: none;" onchange="imgfileChange()">
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function imgfileChange() {
|
||||||
|
var upload_tip = document.getElementById("upload-tip");
|
||||||
|
var img_show = document.getElementById("img-show");
|
||||||
|
var imgfile = document.getElementById("imgfile");
|
||||||
|
|
||||||
|
var freader = new FileReader();
|
||||||
|
freader.readAsDataURL(imgfile.files[0]);
|
||||||
|
freader.onload = function (e) {
|
||||||
|
img_show.src = e.target.result;
|
||||||
|
img_show.style.display = "inline";
|
||||||
|
upload_tip.style.display = "none";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue