By Gt. 注释了源码中widget的全部代码,以及ui中大部分代码(除了后四个,太多了不想管了)

time:2023/11/1 19:41
develop
zhi 2 years ago
parent 7cc37c64ba
commit b672bf26e2

@ -40,11 +40,12 @@ import net.micode.notes.tool.DataUtils;
import java.io.IOException; import java.io.IOException;
// AlarmAlertActivity 类,用于显示闹钟提醒界面
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener { public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
private long mNoteId; private long mNoteId; // 笔记的唯一标识符
private String mSnippet; private String mSnippet; // 笔记的片段内容
private static final int SNIPPET_PREW_MAX_LEN = 60; private static final int SNIPPET_PREW_MAX_LEN = 60; // 笔记片段的最大长度
MediaPlayer mPlayer; MediaPlayer mPlayer; // 播放器对象
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -64,8 +65,10 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
Intent intent = getIntent(); Intent intent = getIntent();
try { try {
// 从意图中获取笔记的唯一标识符,并根据标识符获取笔记片段内容
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1)); mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId); mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
// 如果笔记片段内容超过最大长度,截取并添加附加信息
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)
: mSnippet; : mSnippet;
@ -76,6 +79,7 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
mPlayer = new MediaPlayer(); mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
// 如果笔记在数据库中可见,显示操作对话框并播放闹钟声音
showActionDialog(); showActionDialog();
playAlarmSound(); playAlarmSound();
} else { } else {
@ -89,37 +93,37 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
} }
private void playAlarmSound() { private void playAlarmSound() {
// 获取闹钟铃声的 URI
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM); Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
int silentModeStreams = Settings.System.getInt(getContentResolver(), int silentModeStreams = Settings.System.getInt(getContentResolver(),
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
// 根据静音模式设置播放器的音频流类型
if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) { if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
mPlayer.setAudioStreamType(silentModeStreams); mPlayer.setAudioStreamType(silentModeStreams);
} else { } else {
mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
} }
try { try {
// 设置播放器的数据源,准备播放并循环播放
mPlayer.setDataSource(this, url); mPlayer.setDataSource(this, url);
mPlayer.prepare(); mPlayer.prepare();
mPlayer.setLooping(true); mPlayer.setLooping(true);
mPlayer.start(); mPlayer.start();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} catch (SecurityException e) { } catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
private void showActionDialog() { private void showActionDialog() {
// 显示操作对话框,包括笔记片段内容和按钮
AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(R.string.app_name); dialog.setTitle(R.string.app_name);
dialog.setMessage(mSnippet); dialog.setMessage(mSnippet);
@ -133,6 +137,7 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_NEGATIVE: case DialogInterface.BUTTON_NEGATIVE:
// 点击“进入”按钮,打开 NoteEditActivity 并显示当前笔记
Intent intent = new Intent(this, NoteEditActivity.class); Intent intent = new Intent(this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(Intent.EXTRA_UID, mNoteId); intent.putExtra(Intent.EXTRA_UID, mNoteId);
@ -144,11 +149,13 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
} }
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
// 对话框消失时停止闹钟声音并关闭界面
stopAlarmSound(); stopAlarmSound();
finish(); finish();
} }
private void stopAlarmSound() { private void stopAlarmSound() {
// 停止并释放播放器对象
if (mPlayer != null) { if (mPlayer != null) {
mPlayer.stop(); mPlayer.stop();
mPlayer.release(); mPlayer.release();

@ -30,35 +30,53 @@ import net.micode.notes.data.Notes.NoteColumns;
public class AlarmInitReceiver extends BroadcastReceiver { public class AlarmInitReceiver extends BroadcastReceiver {
// 定义需要查询的列
private static final String [] PROJECTION = new String [] { private static final String [] PROJECTION = new String [] {
NoteColumns.ID, NoteColumns.ID,
NoteColumns.ALERTED_DATE NoteColumns.ALERTED_DATE
}; };
// 定义列索引
private static final int COLUMN_ID = 0; private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1; private static final int COLUMN_ALERTED_DATE = 1;
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
// 获取当前系统时间
long currentDate = System.currentTimeMillis(); long currentDate = System.currentTimeMillis();
// 查询匹配条件的便签信息
Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI, Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION, PROJECTION,
NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE, NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
new String[] { String.valueOf(currentDate) }, new String[] { String.valueOf(currentDate) },
null); null);
// 检查查询结果是否为空
if (c != null) { if (c != null) {
// 检查是否有匹配的记录
if (c.moveToFirst()) { if (c.moveToFirst()) {
do { do {
// 获取提醒时间
long alertDate = c.getLong(COLUMN_ALERTED_DATE); long alertDate = c.getLong(COLUMN_ALERTED_DATE);
// 创建一个意图对象,用于触发闹钟时执行特定的操作
Intent sender = new Intent(context, AlarmReceiver.class); Intent sender = new Intent(context, AlarmReceiver.class);
// 设置数据,通常用于唯一标识某个便签
sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID))); sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID)));
// 创建一个用于发送广播的PendingIntent
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0);
AlarmManager alermManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE); // 获取AlarmManager实例用于设置闹钟
alermManager.set(AlarmManager.RTC_WAKEUP, alertDate, pendingIntent); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// 设置闹钟,触发时间为提醒时间
alarmManager.set(AlarmManager.RTC_WAKEUP, alertDate, pendingIntent);
} while (c.moveToNext()); } while (c.moveToNext());
} }
// 关闭Cursor释放资源
c.close(); c.close();
} }
} }

@ -21,10 +21,16 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
public class AlarmReceiver extends BroadcastReceiver { public class AlarmReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
// 创建一个新的Intent用于启动AlarmAlertActivity
intent.setClass(context, AlarmAlertActivity.class); intent.setClass(context, AlarmAlertActivity.class);
// 添加标志指示要启动一个新的Activity
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 启动指定的Activity
context.startActivity(intent); context.startActivity(intent);
} }
} }

@ -32,6 +32,7 @@ public class DateTimePicker extends FrameLayout {
private static final boolean DEFAULT_ENABLE_STATE = true; private static final boolean DEFAULT_ENABLE_STATE = true;
//定义了一些常用的变量,这些变量是全局的,在这里定义会便于修改
private static final int HOURS_IN_HALF_DAY = 12; private static final int HOURS_IN_HALF_DAY = 12;
private static final int HOURS_IN_ALL_DAY = 24; private static final int HOURS_IN_ALL_DAY = 24;
private static final int DAYS_IN_ALL_WEEK = 7; private static final int DAYS_IN_ALL_WEEK = 7;
@ -64,133 +65,189 @@ public class DateTimePicker extends FrameLayout {
private OnDateTimeChangedListener mOnDateTimeChangedListener; private OnDateTimeChangedListener mOnDateTimeChangedListener;
// 创建一个监听日期选择器值变化事件的监听器
private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() { private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() {
@Override @Override
// 当日期选择器的值发生变化时,下面的方法会被调用
public void onValueChange(NumberPicker picker, int oldVal, int newVal) { public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
// 更新日期对象mDate的日历字段根据新值和旧值之间的差异
mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal); mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal);
// 更新与日期选择相关的用户界面控件,以反映新的日期值
updateDateControl(); updateDateControl();
// 可能用于通知日期时间的整体变化具体实现需要查看onDateTimeChanged()方法的定义
onDateTimeChanged(); onDateTimeChanged();
} }
}; };
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
// 创建一个监听小时选择器值变化事件的监听器
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
@Override @Override
// 当小时选择器的值发生变化时,下面的方法会被调用
public void onValueChange(NumberPicker picker, int oldVal, int newVal) { public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
boolean isDateChanged = false; boolean isDateChanged = false; // 用于标记日期是否发生变化
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance(); // 创建一个日历对象,用于处理日期操作
// 如果不是24小时制
if (!mIs24HourView) { if (!mIs24HourView) {
// 如果不是上午,并且旧值是上午结束的最后一小时,新值是上午开始的第一小时
if (!mIsAm && oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY) { if (!mIsAm && oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY) {
cal.setTimeInMillis(mDate.getTimeInMillis()); cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, 1); // 将日期增加一天
isDateChanged = true; isDateChanged = true; // 标记日期发生变化
} else if (mIsAm && oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) { }
// 如果是上午,并且旧值是上午开始的第一小时,新值是上午结束的最后一小时
else if (mIsAm && oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis()); cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1); cal.add(Calendar.DAY_OF_YEAR, -1); // 将日期减少一天
isDateChanged = true; isDateChanged = true; // 标记日期发生变化
} }
// 如果旧值和新值分别跨越上午/下午的边界
if (oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY || if (oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY ||
oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) { oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
mIsAm = !mIsAm; mIsAm = !mIsAm; // 切换上午和下午标记
updateAmPmControl(); updateAmPmControl(); // 更新上午/下午相关的用户界面控件
} }
} else { }
// 如果是24小时制
else {
// 如果旧值是一天中最后一小时,新值是一天中第一小时
if (oldVal == HOURS_IN_ALL_DAY - 1 && newVal == 0) { if (oldVal == HOURS_IN_ALL_DAY - 1 && newVal == 0) {
cal.setTimeInMillis(mDate.getTimeInMillis()); cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, 1); // 将日期增加一天
isDateChanged = true; isDateChanged = true; // 标记日期发生变化
} else if (oldVal == 0 && newVal == HOURS_IN_ALL_DAY - 1) { }
// 如果旧值是一天中第一小时,新值是一天中最后一小时
else if (oldVal == 0 && newVal == HOURS_IN_ALL_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis()); cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1); cal.add(Calendar.DAY_OF_YEAR, -1); // 将日期减少一天
isDateChanged = true; isDateChanged = true; // 标记日期发生变化
} }
} }
// 计算新的小时值,考虑上午/下午,并更新日期对象中的小时字段
int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY); int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY);
mDate.set(Calendar.HOUR_OF_DAY, newHour); mDate.set(Calendar.HOUR_OF_DAY, newHour);
// 通知日期时间的整体变化
onDateTimeChanged(); onDateTimeChanged();
// 如果日期发生变化,更新当前的年、月、日
if (isDateChanged) { if (isDateChanged) {
setCurrentYear(cal.get(Calendar.YEAR)); setCurrentYear(cal.get(Calendar.YEAR));
setCurrentMonth(cal.get(Calendar.MONTH)); setCurrentMonth(cal.get(Calendar.MONTH));
setCurrentDay(cal.get(Calendar.DAY_OF_MONTH)); setCurrentDay(cal.get(Calendar.DAY_OF_MONTH));
} }
} }
}; };
// 创建一个监听分钟选择器值变化事件的监听器
private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() { private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() {
@Override @Override
// 当分钟选择器的值发生变化时,下面的方法会被调用
public void onValueChange(NumberPicker picker, int oldVal, int newVal) { public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
int minValue = mMinuteSpinner.getMinValue(); int minValue = mMinuteSpinner.getMinValue(); // 获取分钟选择器的最小值
int maxValue = mMinuteSpinner.getMaxValue(); int maxValue = mMinuteSpinner.getMaxValue(); // 获取分钟选择器的最大值
int offset = 0; int offset = 0; // 用于记录小时的偏移量
// 检查是否跨越了分钟的边界,即从最大值切换到最小值或从最小值切换到最大值
if (oldVal == maxValue && newVal == minValue) { if (oldVal == maxValue && newVal == minValue) {
offset += 1; offset += 1; // 如果跨越了分钟的边界将小时偏移量增加1
} else if (oldVal == minValue && newVal == maxValue) { } else if (oldVal == minValue && newVal == maxValue) {
offset -= 1; offset -= 1; // 如果跨越了分钟的边界将小时偏移量减少1
} }
// 如果发生了小时的偏移
if (offset != 0) { if (offset != 0) {
mDate.add(Calendar.HOUR_OF_DAY, offset); mDate.add(Calendar.HOUR_OF_DAY, offset); // 更新日期对象中的小时字段
mHourSpinner.setValue(getCurrentHour()); mHourSpinner.setValue(getCurrentHour()); // 设置小时选择器的值
updateDateControl(); updateDateControl(); // 更新日期控件
int newHour = getCurrentHourOfDay(); int newHour = getCurrentHourOfDay(); // 获取新的小时值
// 根据新的小时值更新上午/下午标记
if (newHour >= HOURS_IN_HALF_DAY) { if (newHour >= HOURS_IN_HALF_DAY) {
mIsAm = false; mIsAm = false; // 如果新的小时值大于等于半天的小时数,表示下午
updateAmPmControl(); updateAmPmControl(); // 更新上午/下午相关的用户界面控件
} else { } else {
mIsAm = true; mIsAm = true; // 否则表示上午
updateAmPmControl(); updateAmPmControl(); // 更新上午/下午相关的用户界面控件
} }
} }
mDate.set(Calendar.MINUTE, newVal);
onDateTimeChanged(); mDate.set(Calendar.MINUTE, newVal); // 更新日期对象中的分钟字段
onDateTimeChanged(); // 通知日期时间的整体变化
} }
}; };
// 创建一个监听上午/下午选择器值变化事件的监听器
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() { private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
@Override @Override
// 当上午/下午选择器的值发生变化时,下面的方法会被调用
public void onValueChange(NumberPicker picker, int oldVal, int newVal) { public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm; mIsAm = !mIsAm; // 切换上午/下午标记的值,如果是上午变为下午,反之亦然
// 根据上午/下午标记的变化,调整日期对象中的小时字段
if (mIsAm) { if (mIsAm) {
mDate.add(Calendar.HOUR_OF_DAY, -HOURS_IN_HALF_DAY); mDate.add(Calendar.HOUR_OF_DAY, -HOURS_IN_HALF_DAY); // 如果是上午减少12小时
} else { } else {
mDate.add(Calendar.HOUR_OF_DAY, HOURS_IN_HALF_DAY); mDate.add(Calendar.HOUR_OF_DAY, HOURS_IN_HALF_DAY); // 如果是下午增加12小时
} }
updateAmPmControl();
onDateTimeChanged(); updateAmPmControl(); // 更新上午/下午选择器的用户界面控件
onDateTimeChanged(); // 通知日期时间的整体变化
} }
}; };
// 定义一个接口,用于监听日期时间变化事件
public interface OnDateTimeChangedListener { public interface OnDateTimeChangedListener {
void onDateTimeChanged(DateTimePicker view, int year, int month, void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute); int dayOfMonth, int hourOfDay, int minute);
} }
// 构造函数用于创建DateTimePicker实例传入上下文参数
public DateTimePicker(Context context) { public DateTimePicker(Context context) {
this(context, System.currentTimeMillis()); this(context, System.currentTimeMillis()); // 调用另一个构造函数并传入当前系统时间
} }
// 构造函数用于创建DateTimePicker实例传入上下文和日期时间参数
public DateTimePicker(Context context, long date) { public DateTimePicker(Context context, long date) {
this(context, date, DateFormat.is24HourFormat(context)); this(context, date, DateFormat.is24HourFormat(context)); // 调用另一个构造函数并传入日期时间和是否为24小时制的参数
} }
// 构造函数用于创建DateTimePicker实例传入上下文、日期时间和是否为24小时制的参数
public DateTimePicker(Context context, long date, boolean is24HourView) { public DateTimePicker(Context context, long date, boolean is24HourView) {
super(context); super(context); // 调用父类构造函数
mDate = Calendar.getInstance(); mDate = Calendar.getInstance(); // 初始化日期时间对象
mInitialising = true; mInitialising = true; // 标记初始化过程中的状态
mIsAm = getCurrentHourOfDay() >= HOURS_IN_HALF_DAY; mIsAm = getCurrentHourOfDay() >= HOURS_IN_HALF_DAY; // 根据当前小时判断是否为上午
// 加载布局文件,将其附加到当前视图
inflate(context, R.layout.datetime_picker, this); inflate(context, R.layout.datetime_picker, this);
// 初始化日期选择器
mDateSpinner = (NumberPicker) findViewById(R.id.date); mDateSpinner = (NumberPicker) findViewById(R.id.date);
mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL); mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL);
mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL); mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL);
mDateSpinner.setOnValueChangedListener(mOnDateChangedListener); mDateSpinner.setOnValueChangedListener(mOnDateChangedListener);
// 初始化小时选择器
mHourSpinner = (NumberPicker) findViewById(R.id.hour); mHourSpinner = (NumberPicker) findViewById(R.id.hour);
mHourSpinner.setOnValueChangedListener(mOnHourChangedListener); mHourSpinner.setOnValueChangedListener(mOnHourChangedListener);
// 初始化分钟选择器
mMinuteSpinner = (NumberPicker) findViewById(R.id.minute); mMinuteSpinner = (NumberPicker) findViewById(R.id.minute);
mMinuteSpinner.setMinValue(MINUT_SPINNER_MIN_VAL); mMinuteSpinner.setMinValue(MINUT_SPINNER_MIN_VAL);
mMinuteSpinner.setMaxValue(MINUT_SPINNER_MAX_VAL); mMinuteSpinner.setMaxValue(MINUT_SPINNER_MAX_VAL);
mMinuteSpinner.setOnLongPressUpdateInterval(100); mMinuteSpinner.setOnLongPressUpdateInterval(100);
mMinuteSpinner.setOnValueChangedListener(mOnMinuteChangedListener); mMinuteSpinner.setOnValueChangedListener(mOnMinuteChangedListener);
// 初始化上午/下午选择器
String[] stringsForAmPm = new DateFormatSymbols().getAmPmStrings(); String[] stringsForAmPm = new DateFormatSymbols().getAmPmStrings();
mAmPmSpinner = (NumberPicker) findViewById(R.id.amPm); mAmPmSpinner = (NumberPicker) findViewById(R.id.amPm);
mAmPmSpinner.setMinValue(AMPM_SPINNER_MIN_VAL); mAmPmSpinner.setMinValue(AMPM_SPINNER_MIN_VAL);
@ -198,92 +255,104 @@ public class DateTimePicker extends FrameLayout {
mAmPmSpinner.setDisplayedValues(stringsForAmPm); mAmPmSpinner.setDisplayedValues(stringsForAmPm);
mAmPmSpinner.setOnValueChangedListener(mOnAmPmChangedListener); mAmPmSpinner.setOnValueChangedListener(mOnAmPmChangedListener);
// update controls to initial state // 更新各控件的初始状态
updateDateControl(); updateDateControl();
updateHourControl(); updateHourControl();
updateAmPmControl(); updateAmPmControl();
set24HourView(is24HourView); set24HourView(is24HourView); // 设置是否为24小时制
// set to current time // 设置当前日期时间
setCurrentDate(date); setCurrentDate(date);
setEnabled(isEnabled()); setEnabled(isEnabled()); // 设置控件是否可用
// set the content descriptions // 设置内容描述,用于辅助功能
mInitialising = false; mInitialising = false; // 初始化过程结束
} }
/**
*
*
* @param enabled
*/
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
if (mIsEnabled == enabled) { if (mIsEnabled == enabled) {
return; return; // 如果已经处于相同状态,无需执行任何操作
} }
super.setEnabled(enabled); super.setEnabled(enabled); // 调用父类方法设置控件的启用状态
mDateSpinner.setEnabled(enabled); mDateSpinner.setEnabled(enabled); // 设置日期选择器是否启用
mMinuteSpinner.setEnabled(enabled); mMinuteSpinner.setEnabled(enabled); // 设置分钟选择器是否启用
mHourSpinner.setEnabled(enabled); mHourSpinner.setEnabled(enabled); // 设置小时选择器是否启用
mAmPmSpinner.setEnabled(enabled); mAmPmSpinner.setEnabled(enabled); // 设置上午/下午选择器是否启用
mIsEnabled = enabled; mIsEnabled = enabled; // 更新控件的启用状态标志
} }
/**
*
*
* @return
*/
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return mIsEnabled; return mIsEnabled; // 返回控件的启用状态标志
} }
/** /**
* Get the current date in millis *
* *
* @return the current date in millis * @return
*/ */
public long getCurrentDateInTimeMillis() { public long getCurrentDateInTimeMillis() {
return mDate.getTimeInMillis(); return mDate.getTimeInMillis(); // 返回当前日期的毫秒表示
} }
/** /**
* Set the current date *
* *
* @param date The current date in millis * @param date
*/ */
public void setCurrentDate(long date) { public void setCurrentDate(long date) {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date); cal.setTimeInMillis(date); // 将传入的日期毫秒值设置到Calendar对象中
setCurrentDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), setCurrentDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)); cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)); // 设置当前日期和时间
} }
/** /**
* Set the current date *
* *
* @param year The current year * @param year
* @param month The current month * @param month
* @param dayOfMonth The current dayOfMonth * @param dayOfMonth
* @param hourOfDay The current hourOfDay * @param hourOfDay
* @param minute The current minute * @param minute
*/ */
public void setCurrentDate(int year, int month, public void setCurrentDate(int year, int month,
int dayOfMonth, int hourOfDay, int minute) { int dayOfMonth, int hourOfDay, int minute) {
setCurrentYear(year); setCurrentYear(year); // 设置当前年份
setCurrentMonth(month); setCurrentMonth(month); // 设置当前月份
setCurrentDay(dayOfMonth); setCurrentDay(dayOfMonth); // 设置当前日
setCurrentHour(hourOfDay); setCurrentHour(hourOfDay); // 设置当前小时
setCurrentMinute(minute); setCurrentMinute(minute); // 设置当前分钟
} }
/** /**
* Get current year *
* *
* @return The current year * @return
*/ */
public int getCurrentYear() { public int getCurrentYear() {
return mDate.get(Calendar.YEAR); return mDate.get(Calendar.YEAR);
} }
/** /**
* Set current year *
* *
* @param year The current year * @param year
*/ */
public void setCurrentYear(int year) { public void setCurrentYear(int year) {
if (!mInitialising && year == getCurrentYear()) { if (!mInitialising && year == getCurrentYear()) {
@ -295,18 +364,18 @@ public class DateTimePicker extends FrameLayout {
} }
/** /**
* Get current month in the year *
* *
* @return The current month in the year * @return
*/ */
public int getCurrentMonth() { public int getCurrentMonth() {
return mDate.get(Calendar.MONTH); return mDate.get(Calendar.MONTH);
} }
/** /**
* Set current month in the year *
* *
* @param month The month in the year * @param month
*/ */
public void setCurrentMonth(int month) { public void setCurrentMonth(int month) {
if (!mInitialising && month == getCurrentMonth()) { if (!mInitialising && month == getCurrentMonth()) {
@ -318,18 +387,18 @@ public class DateTimePicker extends FrameLayout {
} }
/** /**
* Get current day of the month *
* *
* @return The day of the month * @return
*/ */
public int getCurrentDay() { public int getCurrentDay() {
return mDate.get(Calendar.DAY_OF_MONTH); return mDate.get(Calendar.DAY_OF_MONTH);
} }
/** /**
* Set current day of the month *
* *
* @param dayOfMonth The day of the month * @param dayOfMonth
*/ */
public void setCurrentDay(int dayOfMonth) { public void setCurrentDay(int dayOfMonth) {
if (!mInitialising && dayOfMonth == getCurrentDay()) { if (!mInitialising && dayOfMonth == getCurrentDay()) {
@ -341,15 +410,21 @@ public class DateTimePicker extends FrameLayout {
} }
/** /**
* Get current hour in 24 hour mode, in the range (0~23) * 24(0~23)
* @return The current hour in 24 hour mode *
* @return 24
*/ */
public int getCurrentHourOfDay() { public int getCurrentHourOfDay() {
return mDate.get(Calendar.HOUR_OF_DAY); return mDate.get(Calendar.HOUR_OF_DAY);
} }
/**
*
*
* @return
*/
private int getCurrentHour() { private int getCurrentHour() {
if (mIs24HourView){ if (mIs24HourView) {
return getCurrentHourOfDay(); return getCurrentHourOfDay();
} else { } else {
int hour = getCurrentHourOfDay(); int hour = getCurrentHourOfDay();
@ -361,125 +436,170 @@ public class DateTimePicker extends FrameLayout {
} }
} }
/** /**
* Set current hour in 24 hour mode, in the range (0~23) * 24(0~23)
* *
* @param hourOfDay * @param hourOfDay
*/ */
public void setCurrentHour(int hourOfDay) { public void setCurrentHour(int hourOfDay) {
// 如果不是在初始化状态并且设置的小时与当前小时一致,则不执行任何操作。
if (!mInitialising && hourOfDay == getCurrentHourOfDay()) { if (!mInitialising && hourOfDay == getCurrentHourOfDay()) {
return; return;
} }
// 设置日历对象中的小时字段为指定值。
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay); mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
// 如果不是24小时制根据小时值来确定上午或下午。
if (!mIs24HourView) { if (!mIs24HourView) {
if (hourOfDay >= HOURS_IN_HALF_DAY) { if (hourOfDay >= HOURS_IN_HALF_DAY) {
mIsAm = false; mIsAm = false; // 设置为下午
if (hourOfDay > HOURS_IN_HALF_DAY) { if (hourOfDay > HOURS_IN_HALF_DAY) {
hourOfDay -= HOURS_IN_HALF_DAY; hourOfDay -= HOURS_IN_HALF_DAY;
} }
} else { } else {
mIsAm = true; mIsAm = true; // 设置为上午
if (hourOfDay == 0) { if (hourOfDay == 0) {
hourOfDay = HOURS_IN_HALF_DAY; hourOfDay = HOURS_IN_HALF_DAY;
} }
} }
// 更新上午/下午控件的显示。
updateAmPmControl(); updateAmPmControl();
} }
// 更新小时控件的显示。
mHourSpinner.setValue(hourOfDay); mHourSpinner.setValue(hourOfDay);
// 通知日期时间变化的监听器。
onDateTimeChanged(); onDateTimeChanged();
} }
/** /**
* Get currentMinute *
* *
* @return The Current Minute * @return
*/ */
public int getCurrentMinute() { public int getCurrentMinute() {
return mDate.get(Calendar.MINUTE); return mDate.get(Calendar.MINUTE);
} }
/** /**
* Set current minute *
*
*
*/ */
public void setCurrentMinute(int minute) { public void setCurrentMinute(int minute) {
// 如果不是在初始化状态并且设置的分钟与当前分钟一致,则不执行任何操作。
if (!mInitialising && minute == getCurrentMinute()) { if (!mInitialising && minute == getCurrentMinute()) {
return; return;
} }
// 设置分钟控件的显示值。
mMinuteSpinner.setValue(minute); mMinuteSpinner.setValue(minute);
// 设置日历对象中的分钟字段为指定值。
mDate.set(Calendar.MINUTE, minute); mDate.set(Calendar.MINUTE, minute);
// 通知日期时间变化的监听器。
onDateTimeChanged(); onDateTimeChanged();
} }
/** /**
* @return true if this is in 24 hour view else false. * 24
*
* @return 24truefalse
*/ */
public boolean is24HourView () { public boolean is24HourView() {
return mIs24HourView; return mIs24HourView;
} }
/** /**
* Set whether in 24 hour or AM/PM mode. * 24/
* *
* @param is24HourView True for 24 hour mode. False for AM/PM mode. * @param is24HourView true使24使/
*/ */
public void set24HourView(boolean is24HourView) { public void set24HourView(boolean is24HourView) {
// 如果已经是要设置的小时制,不执行任何操作。
if (mIs24HourView == is24HourView) { if (mIs24HourView == is24HourView) {
return; return;
} }
// 更新小时制的状态。
mIs24HourView = is24HourView; mIs24HourView = is24HourView;
// 根据新的小时制设置上午/下午控件的可见性。
mAmPmSpinner.setVisibility(is24HourView ? View.GONE : View.VISIBLE); mAmPmSpinner.setVisibility(is24HourView ? View.GONE : View.VISIBLE);
// 获取当前小时,并根据小时制更新小时控件。
int hour = getCurrentHourOfDay(); int hour = getCurrentHourOfDay();
updateHourControl(); updateHourControl();
setCurrentHour(hour); setCurrentHour(hour);
// 更新上午/下午控件的显示。
updateAmPmControl(); updateAmPmControl();
} }
// 更新日期控件的方法
private void updateDateControl() { private void updateDateControl() {
// 创建一个 Calendar 对象用于日期操作
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
// 设置 Calendar 对象的时间戳为用户选择的日期
cal.setTimeInMillis(mDate.getTimeInMillis()); cal.setTimeInMillis(mDate.getTimeInMillis());
// 向前调整日期以确保在日期控件中显示一周的日期
cal.add(Calendar.DAY_OF_YEAR, -DAYS_IN_ALL_WEEK / 2 - 1); cal.add(Calendar.DAY_OF_YEAR, -DAYS_IN_ALL_WEEK / 2 - 1);
// 清空日期控件的显示值
mDateSpinner.setDisplayedValues(null); mDateSpinner.setDisplayedValues(null);
// 循环生成一周中的日期并存储在 mDateDisplayValues 数组中
for (int i = 0; i < DAYS_IN_ALL_WEEK; ++i) { for (int i = 0; i < DAYS_IN_ALL_WEEK; ++i) {
cal.add(Calendar.DAY_OF_YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, 1);
// 格式化日期为 "MM.dd EEEE" 的字符串形式并存储在 mDateDisplayValues 数组中
mDateDisplayValues[i] = (String) DateFormat.format("MM.dd EEEE", cal); mDateDisplayValues[i] = (String) DateFormat.format("MM.dd EEEE", cal);
} }
// 设置日期控件的显示值为生成的日期数组
mDateSpinner.setDisplayedValues(mDateDisplayValues); mDateSpinner.setDisplayedValues(mDateDisplayValues);
// 将日期控件滚动到一周中间的日期
mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2); mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2);
// 刷新日期控件以更新显示
mDateSpinner.invalidate(); mDateSpinner.invalidate();
} }
// 更新上午/下午控件的方法
private void updateAmPmControl() { private void updateAmPmControl() {
if (mIs24HourView) { if (mIs24HourView) {
// 如果应用使用24小时制则隐藏上午/下午控件
mAmPmSpinner.setVisibility(View.GONE); mAmPmSpinner.setVisibility(View.GONE);
} else { } else {
// 如果应用使用12小时制根据 mIsAm 的值确定上午或下午,并设置对应的值
int index = mIsAm ? Calendar.AM : Calendar.PM; int index = mIsAm ? Calendar.AM : Calendar.PM;
mAmPmSpinner.setValue(index); mAmPmSpinner.setValue(index);
// 显示上午/下午控件
mAmPmSpinner.setVisibility(View.VISIBLE); mAmPmSpinner.setVisibility(View.VISIBLE);
} }
} }
// 更新小时控件的方法
private void updateHourControl() { private void updateHourControl() {
if (mIs24HourView) { if (mIs24HourView) {
// 如果应用使用24小时制设置小时控件的最小和最大值
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_24_HOUR_VIEW); mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_24_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_24_HOUR_VIEW); mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_24_HOUR_VIEW);
} else { } else {
// 如果应用使用12小时制设置小时控件的最小和最大值
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW); mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW); mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW);
} }
} }
/** /**
* Set the callback that indicates the 'Set' button has been pressed. *
* @param callback the callback, if null will do nothing * @param callback null
*/ */
public void setOnDateTimeChangedListener(OnDateTimeChangedListener callback) { public void setOnDateTimeChangedListener(OnDateTimeChangedListener callback) {
// 设置日期时间变化监听器
mOnDateTimeChangedListener = callback; mOnDateTimeChangedListener = callback;
} }
// 当日期时间发生变化时调用的方法
private void onDateTimeChanged() { private void onDateTimeChanged() {
if (mOnDateTimeChangedListener != null) { if (mOnDateTimeChangedListener != null) {
// 如果监听器不为空,触发监听器的回调方法并传递当前选择的年、月、日、小时和分钟作为参数
mOnDateTimeChangedListener.onDateTimeChanged(this, getCurrentYear(), mOnDateTimeChangedListener.onDateTimeChanged(this, getCurrentYear(),
getCurrentMonth(), getCurrentDay(), getCurrentHourOfDay(), getCurrentMinute()); getCurrentMonth(), getCurrentDay(), getCurrentHourOfDay(), getCurrentMinute());
} }
} }
} }

@ -44,45 +44,65 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
super(context); super(context);
mDateTimePicker = new DateTimePicker(context); mDateTimePicker = new DateTimePicker(context);
setView(mDateTimePicker); setView(mDateTimePicker);
// 设置日期时间选择器的监听器,以在日期时间变化时更新标题和数据
mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() { mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() {
public void onDateTimeChanged(DateTimePicker view, int year, int month, public void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute) { int dayOfMonth, int hourOfDay, int minute) {
// 更新内部日期对象 mDate 的值
mDate.set(Calendar.YEAR, year); mDate.set(Calendar.YEAR, year);
mDate.set(Calendar.MONTH, month); mDate.set(Calendar.MONTH, month);
mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth); mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay); mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
mDate.set(Calendar.MINUTE, minute); mDate.set(Calendar.MINUTE, minute);
// 更新对话框的标题
updateTitle(mDate.getTimeInMillis()); updateTitle(mDate.getTimeInMillis());
} }
}); });
// 初始化内部日期对象 mDate并将其秒数设置为 0
mDate.setTimeInMillis(date); mDate.setTimeInMillis(date);
mDate.set(Calendar.SECOND, 0); mDate.set(Calendar.SECOND, 0);
// 设置日期时间选择器的当前日期和时间
mDateTimePicker.setCurrentDate(mDate.getTimeInMillis()); mDateTimePicker.setCurrentDate(mDate.getTimeInMillis());
// 设置对话框的“确定”按钮文本和点击监听器
setButton(context.getString(R.string.datetime_dialog_ok), this); setButton(context.getString(R.string.datetime_dialog_ok), this);
// 设置对话框的“取消”按钮文本,并将其点击监听器设置为 null
setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null); setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null);
// 设置是否使用24小时制时间显示
set24HourView(DateFormat.is24HourFormat(this.getContext())); set24HourView(DateFormat.is24HourFormat(this.getContext()));
// 更新对话框的标题
updateTitle(mDate.getTimeInMillis()); updateTitle(mDate.getTimeInMillis());
} }
public void set24HourView(boolean is24HourView) { public void set24HourView(boolean is24HourView) {
// 设置是否使用24小时制时间显示
mIs24HourView = is24HourView; mIs24HourView = is24HourView;
} }
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) { public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
// 设置日期时间设置监听器
mOnDateTimeSetListener = callBack; mOnDateTimeSetListener = callBack;
} }
private void updateTitle(long date) { private void updateTitle(long date) {
// 定义用于格式化标题的标志
int flag = int flag =
DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_YEAR |
DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_TIME; DateUtils.FORMAT_SHOW_TIME;
// 根据是否使用24小时制时间显示来更新标志
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR; flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
// 根据给定的日期和标志格式化标题并设置为对话框的标题
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag)); setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
} }
public void onClick(DialogInterface arg0, int arg1) { public void onClick(DialogInterface arg0, int arg1) {
if (mOnDateTimeSetListener != null) { if (mOnDateTimeSetListener != null) {
// 当点击“确定”按钮时,如果监听器不为空,触发监听器的回调方法并传递当前选择的日期时间
mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis()); mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis());
} }
} }

@ -33,29 +33,30 @@ public class DropdownMenu {
private Menu mMenu; private Menu mMenu;
public DropdownMenu(Context context, Button button, int menuId) { public DropdownMenu(Context context, Button button, int menuId) {
mButton = button; mButton = button; // 保存传入的按钮引用
mButton.setBackgroundResource(R.drawable.dropdown_icon); mButton.setBackgroundResource(R.drawable.dropdown_icon); // 设置按钮背景图像
mPopupMenu = new PopupMenu(context, mButton); mPopupMenu = new PopupMenu(context, mButton); // 创建弹出菜单与按钮关联
mMenu = mPopupMenu.getMenu(); mMenu = mPopupMenu.getMenu(); // 获取弹出菜单的菜单对象
mPopupMenu.getMenuInflater().inflate(menuId, mMenu); mPopupMenu.getMenuInflater().inflate(menuId, mMenu); // 填充菜单项从指定的menuId
mButton.setOnClickListener(new OnClickListener() { mButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
mPopupMenu.show(); mPopupMenu.show(); // 当按钮被点击时,显示弹出菜单
} }
}); });
} }
public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) { public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) {
if (mPopupMenu != null) { if (mPopupMenu != null) {
mPopupMenu.setOnMenuItemClickListener(listener); mPopupMenu.setOnMenuItemClickListener(listener); // 设置弹出菜单的菜单项点击监听器
} }
} }
public MenuItem findItem(int id) { public MenuItem findItem(int id) {
return mMenu.findItem(id); return mMenu.findItem(id); // 查找特定ID的菜单项
} }
public void setTitle(CharSequence title) { public void setTitle(CharSequence title) {
mButton.setText(title); mButton.setText(title); // 设置按钮的文本标题
} }
} }

@ -31,21 +31,21 @@ import net.micode.notes.data.Notes.NoteColumns;
public class FoldersListAdapter extends CursorAdapter { public class FoldersListAdapter extends CursorAdapter {
public static final String [] PROJECTION = { public static final String [] PROJECTION = {
NoteColumns.ID, NoteColumns.ID, // 列投影数组的索引0
NoteColumns.SNIPPET NoteColumns.SNIPPET // 列投影数组的索引1
}; };
public static final int ID_COLUMN = 0; public static final int ID_COLUMN = 0; // 列投影数组的ID列索引
public static final int NAME_COLUMN = 1; public static final int NAME_COLUMN = 1; // 列投影数组的名称列索引
public FoldersListAdapter(Context context, Cursor c) { public FoldersListAdapter(Context context, Cursor c) {
super(context, c); super(context, c);
// TODO Auto-generated constructor stub // 构造函数初始化CursorAdapter
} }
@Override @Override
public View newView(Context context, Cursor cursor, ViewGroup parent) { public View newView(Context context, Cursor cursor, ViewGroup parent) {
return new FolderListItem(context); return new FolderListItem(context); // 创建新的视图用于显示数据项
} }
@Override @Override
@ -53,14 +53,14 @@ public class FoldersListAdapter extends CursorAdapter {
if (view instanceof FolderListItem) { if (view instanceof FolderListItem) {
String folderName = (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context String folderName = (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
((FolderListItem) view).bind(folderName); ((FolderListItem) view).bind(folderName); // 将数据绑定到视图
} }
} }
public String getFolderName(Context context, int position) { public String getFolderName(Context context, int position) {
Cursor cursor = (Cursor) getItem(position); Cursor cursor = (Cursor) getItem(position); // 获取特定位置的Cursor
return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); // 根据游标数据返回文件夹名称
} }
private class FolderListItem extends LinearLayout { private class FolderListItem extends LinearLayout {
@ -68,13 +68,12 @@ public class FoldersListAdapter extends CursorAdapter {
public FolderListItem(Context context) { public FolderListItem(Context context) {
super(context); super(context);
inflate(context, R.layout.folder_list_item, this); inflate(context, R.layout.folder_list_item, this); // 填充视图布局
mName = (TextView) findViewById(R.id.tv_folder_name); mName = (TextView) findViewById(R.id.tv_folder_name); // 获取文件夹名称的TextView
} }
public void bind(String name) { public void bind(String name) {
mName.setText(name); mName.setText(name); // 设置文件夹名称文本
} }
} }
} }

@ -45,7 +45,7 @@ public class NoteEditText extends EditText {
private static final String SCHEME_TEL = "tel:" ; private static final String SCHEME_TEL = "tel:" ;
private static final String SCHEME_HTTP = "http:" ; private static final String SCHEME_HTTP = "http:" ;
private static final String SCHEME_EMAIL = "mailto:" ; private static final String SCHEME_EMAIL = "mailto:" ;
// 定义一个映射将不同的URL scheme与资源ID关联起来
private static final Map<String, Integer> sSchemaActionResMap = new HashMap<String, Integer>(); private static final Map<String, Integer> sSchemaActionResMap = new HashMap<String, Integer>();
static { static {
sSchemaActionResMap.put(SCHEME_TEL, R.string.note_link_tel); sSchemaActionResMap.put(SCHEME_TEL, R.string.note_link_tel);
@ -54,24 +54,16 @@ public class NoteEditText extends EditText {
} }
/** /**
* Call by the {@link NoteEditActivity} to delete or add edit text * NoteEditActivityEditText
*/ */
public interface OnTextViewChangeListener { public interface OnTextViewChangeListener {
/** // 当文本为空且按下删除键KEYCODE_DEL删除当前EditText
* Delete current edit text when {@link KeyEvent#KEYCODE_DEL} happens
* and the text is null
*/
void onEditTextDelete(int index, String text); void onEditTextDelete(int index, String text);
/** // 当按下回车键KEYCODE_ENTER在当前EditText之后添加EditText
* Add edit text after current edit text when {@link KeyEvent#KEYCODE_ENTER}
* happen
*/
void onEditTextEnter(int index, String text); void onEditTextEnter(int index, String text);
/** // 当文本发生更改时,隐藏或显示项目选项
* Hide or show item option when text change
*/
void onTextChange(int index, boolean hasText); void onTextChange(int index, boolean hasText);
} }
@ -81,11 +73,11 @@ public class NoteEditText extends EditText {
super(context, null); super(context, null);
mIndex = 0; mIndex = 0;
} }
// 设置EditText的索引
public void setIndex(int index) { public void setIndex(int index) {
mIndex = index; mIndex = index;
} }
// 设置文本变化监听器
public void setOnTextViewChangeListener(OnTextViewChangeListener listener) { public void setOnTextViewChangeListener(OnTextViewChangeListener listener) {
mOnTextViewChangeListener = listener; mOnTextViewChangeListener = listener;
} }
@ -96,11 +88,13 @@ public class NoteEditText extends EditText {
public NoteEditText(Context context, AttributeSet attrs, int defStyle) { public NoteEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
// TODO Auto-generated constructor stub // TODO 自动生成的构造函数存根
} }
@Override @Override
// 处理touch事件用于选择文本
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
// 在用户按下时,选择文本
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
@ -122,9 +116,11 @@ public class NoteEditText extends EditText {
} }
@Override @Override
// 处理按键按下事件
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_ENTER:
// 当按下回车键KEYCODE_ENTER如果有文本变化监听器返回false
if (mOnTextViewChangeListener != null) { if (mOnTextViewChangeListener != null) {
return false; return false;
} }
@ -139,9 +135,11 @@ public class NoteEditText extends EditText {
} }
@Override @Override
// 处理按键释放事件
public boolean onKeyUp(int keyCode, KeyEvent event) { public boolean onKeyUp(int keyCode, KeyEvent event) {
switch(keyCode) { switch(keyCode) {
case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_DEL:
// 处理按键释放事件,回车和删除键
if (mOnTextViewChangeListener != null) { if (mOnTextViewChangeListener != null) {
if (0 == mSelectionStartBeforeDelete && mIndex != 0) { if (0 == mSelectionStartBeforeDelete && mIndex != 0) {
mOnTextViewChangeListener.onEditTextDelete(mIndex, getText().toString()); mOnTextViewChangeListener.onEditTextDelete(mIndex, getText().toString());
@ -152,6 +150,7 @@ public class NoteEditText extends EditText {
} }
break; break;
case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_ENTER:
if (mOnTextViewChangeListener != null) { if (mOnTextViewChangeListener != null) {
int selectionStart = getSelectionStart(); int selectionStart = getSelectionStart();
String text = getText().subSequence(selectionStart, length()).toString(); String text = getText().subSequence(selectionStart, length()).toString();
@ -168,7 +167,9 @@ public class NoteEditText extends EditText {
} }
@Override @Override
// 当焦点发生变化时的回调
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
// 当焦点发生变化时,通知文本变化监听器
if (mOnTextViewChangeListener != null) { if (mOnTextViewChangeListener != null) {
if (!focused && TextUtils.isEmpty(getText())) { if (!focused && TextUtils.isEmpty(getText())) {
mOnTextViewChangeListener.onTextChange(mIndex, false); mOnTextViewChangeListener.onTextChange(mIndex, false);
@ -181,6 +182,8 @@ public class NoteEditText extends EditText {
@Override @Override
protected void onCreateContextMenu(ContextMenu menu) { protected void onCreateContextMenu(ContextMenu menu) {
// 创建上下文菜单
// 在文本上下文菜单中添加选项
if (getText() instanceof Spanned) { if (getText() instanceof Spanned) {
int selStart = getSelectionStart(); int selStart = getSelectionStart();
int selEnd = getSelectionEnd(); int selEnd = getSelectionEnd();

@ -75,7 +75,7 @@ public class NoteItemData {
private boolean mIsOnlyOneItem; private boolean mIsOnlyOneItem;
private boolean mIsOneNoteFollowingFolder; private boolean mIsOneNoteFollowingFolder;
private boolean mIsMultiNotesFollowingFolder; private boolean mIsMultiNotesFollowingFolder;
// 构造函数,用于初始化笔记项数据
public NoteItemData(Context context, Cursor cursor) { public NoteItemData(Context context, Cursor cursor) {
mId = cursor.getLong(ID_COLUMN); mId = cursor.getLong(ID_COLUMN);
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN); mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);
@ -108,15 +108,18 @@ public class NoteItemData {
} }
checkPostion(cursor); checkPostion(cursor);
} }
// 检查笔记项在Cursor中的位置设置一些标志
private void checkPostion(Cursor cursor) { private void checkPostion(Cursor cursor) {
// 检查是否是最后一项
mIsLastItem = cursor.isLast() ? true : false; mIsLastItem = cursor.isLast() ? true : false;
// 检查是否是第一项
mIsFirstItem = cursor.isFirst() ? true : false; mIsFirstItem = cursor.isFirst() ? true : false;
mIsOnlyOneItem = (cursor.getCount() == 1); mIsOnlyOneItem = (cursor.getCount() == 1);
mIsMultiNotesFollowingFolder = false; mIsMultiNotesFollowingFolder = false;
mIsOneNoteFollowingFolder = false; mIsOneNoteFollowingFolder = false;
if (mType == Notes.TYPE_NOTE && !mIsFirstItem) { if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {
// 检查笔记项是否在文件夹后有多个笔记
int position = cursor.getPosition(); int position = cursor.getPosition();
if (cursor.moveToPrevious()) { if (cursor.moveToPrevious()) {
if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER
@ -133,15 +136,15 @@ public class NoteItemData {
} }
} }
} }
// 检查笔记项是否在文件夹后有一个笔记
public boolean isOneFollowingFolder() { public boolean isOneFollowingFolder() {
return mIsOneNoteFollowingFolder; return mIsOneNoteFollowingFolder;
} }
// 检查笔记项是否在文件夹后有多个笔记
public boolean isMultiFollowingFolder() { public boolean isMultiFollowingFolder() {
return mIsMultiNotesFollowingFolder; return mIsMultiNotesFollowingFolder;
} }
// 检查笔记项是否是最后一项
public boolean isLast() { public boolean isLast() {
return mIsLastItem; return mIsLastItem;
} }
@ -149,7 +152,7 @@ public class NoteItemData {
public String getCallName() { public String getCallName() {
return mName; return mName;
} }
// 检查笔记项是否是第一项
public boolean isFirst() { public boolean isFirst() {
return mIsFirstItem; return mIsFirstItem;
} }

@ -46,52 +46,88 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
private static final String TAG = "NoteWidgetProvider"; private static final String TAG = "NoteWidgetProvider";
@Override @Override
// 当小部件从主屏幕中被删除时调用的方法
public void onDeleted(Context context, int[] appWidgetIds) { public void onDeleted(Context context, int[] appWidgetIds) {
// 创建 ContentValues 对象,用于存储更新数据库的数值
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
// 将 NoteColumns.WIDGET_ID 的值设置为无效的小部件 IDAppWidgetManager.INVALID_APPWIDGET_ID
values.put(NoteColumns.WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); values.put(NoteColumns.WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
// 遍历传入的小部件 ID 数组
for (int i = 0; i < appWidgetIds.length; i++) { for (int i = 0; i < appWidgetIds.length; i++) {
context.getContentResolver().update(Notes.CONTENT_NOTE_URI, // 使用 ContentResolver 更新 Notes 数据库中的相应小部件 ID 的记录
values, context.getContentResolver().update(
NoteColumns.WIDGET_ID + "=?", Notes.CONTENT_NOTE_URI, // 更新的数据表的 URI
new String[] { String.valueOf(appWidgetIds[i])}); values, // 更新的数值
NoteColumns.WIDGET_ID + "=?", // 更新的条件,匹配小部件 ID
new String[] { String.valueOf(appWidgetIds[i]) } // 匹配条件的参数,传入当前小部件 ID
);
} }
} }
// 获取与小部件相关的笔记信息的方法
// 参数 context上下文对象用于访问内容提供程序
// 参数 widgetId要获取信息的小部件的唯一标识符
// 返回值:包含笔记信息的游标对象
private Cursor getNoteWidgetInfo(Context context, int widgetId) { private Cursor getNoteWidgetInfo(Context context, int widgetId) {
return context.getContentResolver().query(Notes.CONTENT_NOTE_URI, // 使用内容解析器查询 Notes 数据库中的记录
PROJECTION, // 查询的条件是NoteColumns.WIDGET_ID 等于给定 widgetId同时 NoteColumns.PARENT_ID 不等于垃圾箱的 IDNotes.ID_TRASH_FOLER
NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?", // 查询的列是由 PROJECTION 常量指定的列数组
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) }, return context.getContentResolver().query(
null); Notes.CONTENT_NOTE_URI, // 查询的数据表的 URI
PROJECTION, // 查询的列数组
NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?", // 查询的条件
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) }, // 查询条件的参数
null // 不排序
);
} }
// update 方法的重载,用于执行小部件更新操作
// 参数 context上下文对象用于访问资源和小部件管理器
// 参数 appWidgetManager小部件管理器用于更新小部件
// 参数 appWidgetIds包含要更新的小部件 ID 的数组
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// 调用 update 方法的重载版本,传入默认参数 false
update(context, appWidgetManager, appWidgetIds, false); update(context, appWidgetManager, appWidgetIds, false);
} }
private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds,
boolean privacyMode) { // update 方法,用于更新小部件
// 参数 context上下文对象用于访问资源和小部件管理器
// 参数 appWidgetManager小部件管理器用于更新小部件
// 参数 appWidgetIds包含要更新的小部件 ID 的数组
// 参数 privacyMode一个布尔值表示小部件是否处于隐私模式
private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, boolean privacyMode) {
for (int i = 0; i < appWidgetIds.length; i++) { for (int i = 0; i < appWidgetIds.length; i++) {
if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) { if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) {
// 获取默认背景 ID
int bgId = ResourceParser.getDefaultBgId(context); int bgId = ResourceParser.getDefaultBgId(context);
// 初始化一个空字符串用于存储文本片段
String snippet = ""; String snippet = "";
// 创建一个意图,用于打开 NoteEditActivity
Intent intent = new Intent(context, NoteEditActivity.class); Intent intent = new Intent(context, NoteEditActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(Notes.INTENT_EXTRA_WIDGET_ID, appWidgetIds[i]); intent.putExtra(Notes.INTENT_EXTRA_WIDGET_ID, appWidgetIds[i]);
intent.putExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, getWidgetType()); intent.putExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, getWidgetType());
// 查询与当前小部件相关的笔记信息
Cursor c = getNoteWidgetInfo(context, appWidgetIds[i]); Cursor c = getNoteWidgetInfo(context, appWidgetIds[i]);
if (c != null && c.moveToFirst()) { if (c != null && c.moveToFirst()) {
// 如果查询结果中有多于一个记录,记录错误并返回
if (c.getCount() > 1) { if (c.getCount() > 1) {
Log.e(TAG, "Multiple message with same widget id:" + appWidgetIds[i]); Log.e(TAG, "Multiple message with the same widget id:" + appWidgetIds[i]);
c.close(); c.close();
return; return;
} }
// 从查询结果中获取文本片段和背景颜色 ID
snippet = c.getString(COLUMN_SNIPPET); snippet = c.getString(COLUMN_SNIPPET);
bgId = c.getInt(COLUMN_BG_COLOR_ID); bgId = c.getInt(COLUMN_BG_COLOR_ID);
// 设置 intent 中的额外数据,包括笔记的唯一标识符和操作类型
intent.putExtra(Intent.EXTRA_UID, c.getLong(COLUMN_ID)); intent.putExtra(Intent.EXTRA_UID, c.getLong(COLUMN_ID));
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
} else { } else {
// 如果没有查询到相关信息,使用默认文本片段和插入/编辑操作类型
snippet = context.getResources().getString(R.string.widget_havenot_content); snippet = context.getResources().getString(R.string.widget_havenot_content);
intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.setAction(Intent.ACTION_INSERT_OR_EDIT);
} }
@ -100,30 +136,35 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
c.close(); c.close();
} }
// 创建远程视图对象,用于配置小部件的外观
RemoteViews rv = new RemoteViews(context.getPackageName(), getLayoutId()); RemoteViews rv = new RemoteViews(context.getPackageName(), getLayoutId());
rv.setImageViewResource(R.id.widget_bg_image, getBgResourceId(bgId)); rv.setImageViewResource(R.id.widget_bg_image, getBgResourceId(bgId));
// 设置 intent 中的额外数据,包括背景 ID
intent.putExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, bgId); intent.putExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, bgId);
/**
* Generate the pending intent to start host for the widget // 生成用于启动小部件的挂起意图
*/
PendingIntent pendingIntent = null; PendingIntent pendingIntent = null;
if (privacyMode) { if (privacyMode) {
rv.setTextViewText(R.id.widget_text, // 如果小部件处于隐私模式,设置文本为特定文本并创建 NotesListActivity 的意图
context.getString(R.string.widget_under_visit_mode)); rv.setTextViewText(R.id.widget_text, context.getString(R.string.widget_under_visit_mode));
pendingIntent = PendingIntent.getActivity(context, appWidgetIds[i], new Intent( pendingIntent = PendingIntent.getActivity(context, appWidgetIds[i], new Intent(
context, NotesListActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); context, NotesListActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
} else { } else {
// 如果不是隐私模式,将文本设置为笔记片段,并创建打开笔记编辑界面的意图
rv.setTextViewText(R.id.widget_text, snippet); rv.setTextViewText(R.id.widget_text, snippet);
pendingIntent = PendingIntent.getActivity(context, appWidgetIds[i], intent, pendingIntent = PendingIntent.getActivity(context, appWidgetIds[i], intent,
PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT);
} }
// 设置小部件的点击行为
rv.setOnClickPendingIntent(R.id.widget_text, pendingIntent); rv.setOnClickPendingIntent(R.id.widget_text, pendingIntent);
// 更新小部件
appWidgetManager.updateAppWidget(appWidgetIds[i], rv); appWidgetManager.updateAppWidget(appWidgetIds[i], rv);
} }
} }
} }
protected abstract int getBgResourceId(int bgId); protected abstract int getBgResourceId(int bgId);
protected abstract int getLayoutId(); protected abstract int getLayoutId();

@ -23,23 +23,28 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser; import net.micode.notes.tool.ResourceParser;
// NoteWidgetProvider_2x 类是 NoteWidgetProvider 的子类,用于特定类型的小部件
public class NoteWidgetProvider_2x extends NoteWidgetProvider { public class NoteWidgetProvider_2x extends NoteWidgetProvider {
@Override @Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// 调用父类的 update 方法以执行小部件更新操作
super.update(context, appWidgetManager, appWidgetIds); super.update(context, appWidgetManager, appWidgetIds);
} }
// 获取小部件的布局资源 ID
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.widget_2x; return R.layout.widget_2x;
} }
// 获取与小部件类型相关的背景资源 ID
@Override @Override
protected int getBgResourceId(int bgId) { protected int getBgResourceId(int bgId) {
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId); return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
} }
// 获取小部件的类型,此处返回 Notes.TYPE_WIDGET_2X
@Override @Override
protected int getWidgetType() { protected int getWidgetType() {
return Notes.TYPE_WIDGET_2X; return Notes.TYPE_WIDGET_2X;

@ -23,22 +23,28 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser; import net.micode.notes.tool.ResourceParser;
// NoteWidgetProvider_4x 类是 NoteWidgetProvider 的子类,用于特定类型的小部件
public class NoteWidgetProvider_4x extends NoteWidgetProvider { public class NoteWidgetProvider_4x extends NoteWidgetProvider {
@Override @Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// 调用父类的 update 方法以执行小部件更新操作
super.update(context, appWidgetManager, appWidgetIds); super.update(context, appWidgetManager, appWidgetIds);
} }
// 获取小部件的布局资源 ID此处返回 R.layout.widget_4x
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.widget_4x; return R.layout.widget_4x;
} }
// 获取与小部件类型相关的背景资源 ID
@Override @Override
protected int getBgResourceId(int bgId) { protected int getBgResourceId(int bgId) {
// 使用 ResourceParser 获取 4x 小部件的背景资源
return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId); return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId);
} }
// 获取小部件的类型,此处返回 Notes.TYPE_WIDGET_4X
@Override @Override
protected int getWidgetType() { protected int getWidgetType() {
return Notes.TYPE_WIDGET_4X; return Notes.TYPE_WIDGET_4X;

Loading…
Cancel
Save