|
|
@ -38,9 +38,11 @@ import android.location.LocationListener;
|
|
|
|
import android.location.LocationManager;
|
|
|
|
import android.location.LocationManager;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.Spannable;
|
|
|
|
import android.text.Spannable;
|
|
|
|
import android.text.SpannableString;
|
|
|
|
import android.text.SpannableString;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.text.format.DateUtils;
|
|
|
|
import android.text.format.DateUtils;
|
|
|
|
import android.text.style.BackgroundColorSpan;
|
|
|
|
import android.text.style.BackgroundColorSpan;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
@ -69,6 +71,8 @@ import android.speech.tts.TextToSpeech.OnInitListener;
|
|
|
|
import net.micode.notes.R;
|
|
|
|
import net.micode.notes.R;
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
import net.micode.notes.data.Notes.TextNote;
|
|
|
|
import net.micode.notes.data.Notes.TextNote;
|
|
|
|
|
|
|
|
import net.micode.notes.gtask.data.Task;
|
|
|
|
|
|
|
|
import net.micode.notes.gtask.data.TaskList;
|
|
|
|
import net.micode.notes.model.WorkingNote;
|
|
|
|
import net.micode.notes.model.WorkingNote;
|
|
|
|
import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
|
|
|
|
import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
|
|
|
|
import net.micode.notes.tool.DataUtils;
|
|
|
|
import net.micode.notes.tool.DataUtils;
|
|
|
@ -88,6 +92,8 @@ import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Stack;
|
|
|
|
|
|
|
|
import java.util.Vector;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
@ -111,6 +117,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
public ImageView startDraw;
|
|
|
|
public ImageView startDraw;
|
|
|
|
|
|
|
|
|
|
|
|
public ImageButton note_Read;
|
|
|
|
public ImageButton note_Read;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Button note_revote;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
@ -163,12 +171,16 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
|
|
|
|
|
|
|
private EditText mNoteEditor;
|
|
|
|
private EditText mNoteEditor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Vector<SpannableString> mHistory = new Vector<SpannableString>(10);
|
|
|
|
|
|
|
|
|
|
|
|
private View mNoteEditorPanel;
|
|
|
|
private View mNoteEditorPanel;
|
|
|
|
|
|
|
|
|
|
|
|
//private final static int REQUEST_CODE_NEW_NODE = 103;
|
|
|
|
//private final static int REQUEST_CODE_NEW_NODE = 103;
|
|
|
|
|
|
|
|
|
|
|
|
private WorkingNote mWorkingNote;
|
|
|
|
private WorkingNote mWorkingNote;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean mIsRevort;
|
|
|
|
|
|
|
|
|
|
|
|
private SharedPreferences mSharedPrefs;
|
|
|
|
private SharedPreferences mSharedPrefs;
|
|
|
|
private int mFontSizeId;
|
|
|
|
private int mFontSizeId;
|
|
|
|
|
|
|
|
|
|
|
@ -411,6 +423,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
|
|
|
|
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
|
|
|
|
mNoteHeaderHolder.startDraw = (ImageButton) findViewById(R.id.imageButton2);
|
|
|
|
mNoteHeaderHolder.startDraw = (ImageButton) findViewById(R.id.imageButton2);
|
|
|
|
mNoteHeaderHolder.note_Read = (ImageButton) findViewById(R.id.menu_note_read);
|
|
|
|
mNoteHeaderHolder.note_Read = (ImageButton) findViewById(R.id.menu_note_read);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.note_revote = (Button) findViewById(R.id.action_undo);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.note_revote.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
backTrack();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
mNoteHeaderHolder.note_Read.setOnClickListener(new OnClickListener() {
|
|
|
|
mNoteHeaderHolder.note_Read.setOnClickListener(new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
public void onClick(View view) {
|
|
|
@ -432,6 +451,26 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
|
|
|
|
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
|
|
|
|
|
|
|
|
mNoteEditor.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void afterTextChanged(Editable editable) {
|
|
|
|
|
|
|
|
if (!mIsRevort){
|
|
|
|
|
|
|
|
saveHistory();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
mIsRevort = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
|
|
|
|
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
|
|
|
|
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
|
|
|
|
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
|
|
|
|
for (int id : sBgSelectorBtnsMap.keySet()) {
|
|
|
|
for (int id : sBgSelectorBtnsMap.keySet()) {
|
|
|
@ -482,6 +521,33 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
clearSettingState();
|
|
|
|
clearSettingState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void saveHistory(){
|
|
|
|
|
|
|
|
SpannableString input_text = new SpannableString(mNoteEditor.getText());
|
|
|
|
|
|
|
|
if (mHistory.size() >= 10){
|
|
|
|
|
|
|
|
mHistory.removeElementAt(0);
|
|
|
|
|
|
|
|
mHistory.add(input_text);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
mHistory.add(input_text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mNoteHeaderHolder.note_revote.setEnabled(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void backTrack(){
|
|
|
|
|
|
|
|
int stack_size = mHistory.size();
|
|
|
|
|
|
|
|
mIsRevort = true;
|
|
|
|
|
|
|
|
if (stack_size <= 1){
|
|
|
|
|
|
|
|
mNoteHeaderHolder.note_revote.setEnabled(false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
mNoteEditor.setText((CharSequence) mHistory.elementAt(stack_size - 2));
|
|
|
|
|
|
|
|
mHistory.removeElementAt(stack_size - 1);
|
|
|
|
|
|
|
|
if (stack_size == 2){
|
|
|
|
|
|
|
|
mNoteHeaderHolder.note_revote.setEnabled(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void updateWidget() {
|
|
|
|
private void updateWidget() {
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
|