});\r
\r
// updateList();\r
- int noteItemType = pref.getInt(Constant.PREF_NOTE_ITEM_TYPE,\r
+ int noteItemType = pref.getInt(Constant.PREF_NOTE_ITEM_TYPE_TMP,\r
Constant.NOTE_ITEM_TYPE_ALL);\r
NoteTypeListTask task = new NoteTypeListTask(this, noteItemType);\r
AsyncTaskCommand command = new AsyncTaskCommand(this, task);\r
package com.yuji.ec;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
+import com.yuji.ec.common.CommonUtil;
import com.yuji.ec.common.Constant;
import com.yuji.ec.task.NoteUpdateTask;
import com.yuji.ec.utility.AsyncTaskCommand;
Bundle ex = data.getExtras();
String guid = ex.getString(Constant.EXTRA_GUID);
String title = ex.getString(Constant.EXTRA_TITLE);
+ int noteItemType = noteTypeSpinner.getSelectedItemPosition();
+ this.guid = guid;
pref.put(Constant.PREF_NOTE_ITEM_GUID_TMP, guid);
pref.put(Constant.PREF_NOTE_ITEM_TEXT, title);
+ pref.put(Constant.PREF_NOTE_ITEM_GUID_TYPE_TMP, noteItemType);
pref.update();
noteTypeView.setText(title);
}
private void updateButtonOnClick() {
- NoteUpdateTask task = new NoteUpdateTask(this);
+ int noteItemType = noteTypeSpinner.getSelectedItemPosition();
+
+ NoteUpdateTask task = new NoteUpdateTask(this, noteItemType, guid);
AsyncTaskCommand command = new AsyncTaskCommand(this, task);
// command.setTitle(getString(R.string.noteListGetting)); // TODO
command.setTitle("Title"); // TODO
}
private void setStatus() {
- int noteType = noteTypeSpinner.getSelectedItemPosition();
+ /*
+ \81\9b\91Î\8fÛ
+ type
+ guid
+ guidType(guid\82Ì\90Ý\92è\83^\83C\83~\83\93\83O\82Å\90Ý\92è\81A\8f\89\8aú\92lnull)
+
+ \81\9b\8dX\90V\83{\83^\83\93\82Ì\8a\88\90«\83\8b\81[\83\8b(\8a\88\90«\82Ì\8fð\8c\8f)
+ type1=type2
+ guid1<>guid2
+ guidType=type2
+
+ type1<>type2
+ guidType=type2
+ */
+ int srcNoteItemType = pref.getInt(Constant.PREF_NOTE_ITEM_TYPE,
+ Constant.NOTE_ITEM_TYPE_ALL);
+ String srcGuid = pref.get(Constant.PREF_NOTE_ITEM_GUID);
+
+ int noteItemType = noteTypeSpinner.getSelectedItemPosition();
+ int guidType = pref.getInt(Constant.PREF_NOTE_ITEM_GUID_TYPE_TMP, -1);
+
+ boolean enabled = false;
+ if (noteItemType == Constant.NOTE_ITEM_TYPE_ALL){
+ enabled = true;
+ }
+ else if (srcNoteItemType == noteItemType){
+ if (!CommonUtil.isNull(guid) && !guid.equals(srcGuid)){
+ if (guidType >= 0 && guidType == noteItemType){
+ enabled = true;
+ }
+ }
+ }
+ else {
+ if (guidType >= 0 && guidType == noteItemType){
+ enabled = true;
+ }
+ }
+
+ updateButton.setEnabled(enabled);
noteTypeLayout
- .setVisibility((noteType == Constant.NOTE_ITEM_TYPE_ALL) ? View.GONE
+ .setVisibility((noteItemType == Constant.NOTE_ITEM_TYPE_ALL) ? View.GONE
: View.VISIBLE);
}
+ public static void init(Context context){
+ EditPrefUtil pref = new EditPrefUtil(context);
+
+ pref.copy(Constant.PREF_NOTE_ITEM_TYPE, Constant.PREF_NOTE_ITEM_TYPE_TMP);
+ pref.copy(Constant.PREF_NOTE_ITEM_GUID, Constant.PREF_NOTE_ITEM_GUID_TMP);
+ pref.remove(Constant.PREF_NOTE_ITEM_GUID_TYPE_TMP);
+
+ pref.update();
+ }
}
import java.util.Calendar;
import android.app.TimePickerDialog;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
// }
private void noteButtonOnClick(){
- pref.copy(Constant.PREF_NOTE_ITEM_TYPE, Constant.PREF_NOTE_ITEM_TYPE_TMP);
- pref.copy(Constant.PREF_NOTE_ITEM_GUID, Constant.PREF_NOTE_ITEM_GUID_TMP);
+// pref.copy(Constant.PREF_NOTE_ITEM_TYPE, Constant.PREF_NOTE_ITEM_TYPE_TMP);
+// pref.copy(Constant.PREF_NOTE_ITEM_GUID, Constant.PREF_NOTE_ITEM_GUID_TMP);
+// pref.remove(Constant.PREF_NOTE_ITEM_GUID_TYPE_TMP);
+// pref.update();
+ NoteUpdatorActivity.init(this);
Intent intent = new Intent(this, (Class<?>) NoteUpdatorActivity.class);
startActivityForResult(intent, 1); // TODO
}
protected void timeCheckBoxOnClick(CompoundButton buttonView,
boolean isChecked) {
+ if (isChecked){
+
+ }
+ else {
+ pref.put(Constant.PREF_UPDATE_TIME_TMP, -1);
+ pref.update();
+ }
+
setStatus();
}
updateTime = t;
timeView.setText(str);
- }
+
+ pref.put(Constant.PREF_UPDATE_TIME_TMP, t);
+ pref.update();
+ }
}, hour, minute, true);
timePickerDialog.show();
}
// noteButton.setEnabled(true);
// headerButton.setEnabled(true);
}
+
+ public static void init(Context context){
+ EditPrefUtil pref = new EditPrefUtil(context);
+
+ pref.put(Constant.PREF_UPDATE_TIME_TMP, -1);
+ pref.update();
+ }
}
public static final String PREF_NOTE_ITEM_GUID = "NOTE_ITEM_GUID";
public static final String PREF_NOTE_ITEM_TYPE_TMP = "NOTE_ITEM_TYPE_TMP";
public static final String PREF_NOTE_ITEM_GUID_TMP = "NOTE_ITEM_GUID_TMP";
+ public static final String PREF_NOTE_ITEM_GUID_TYPE_TMP = "NOTE_ITEM_GUID_TYPE_TMP";
public static final String PREF_NOTE_ITEM_TEXT = "NOTE_ITEM_TEXT";
public static final String PREF_NOTE_ORDER = "NOTE_ORDER";
public static final String PREF_NOTE_ORDER_BY = "NOTE_ORDER_BY";
public static final String PREF_AUTO_UPDATE = "AUTO_UPDATE";
public static final String PREF_UPDATE_TIME = "UPDATE_TIME";
+ public static final String PREF_UPDATE_TIME_TMP = "UPDATE_TIME_TMP";
public static final String EXTRA_GUID = "GUID";
public static final String EXTRA_TITLE = "TITLE";
private NoteList noteList;
private WeakReference<NoteUpdatorActivity> activityRef;
private EvernoteUtil.Error errorCode = null;
+ private int noteItemType;
+ private String guid;
- public NoteUpdateTask(NoteUpdatorActivity activity) {
+ public NoteUpdateTask(NoteUpdatorActivity activity, int noteItemType, String guid) {
activityRef = new WeakReference<NoteUpdatorActivity>(activity);
+ this.noteItemType = noteItemType;
+ this.guid = guid;
}
public void doExecute() {
synchronized (util) {
try {
NoteUpdator updator = new NoteUpdator();
- updator.update(activityRef.get());
+ updator.update(activityRef.get(), noteItemType, guid);
} finally {
errorCode = util.getErrorCode();
}
import com.yuji.ec.db.NoteDao;\r
\r
public class NoteUpdator {\r
- private int itemType = Constant.NOTE_ITEM_TYPE_ALL;\r
- private String guid = null;\r
-\r
- public void update(Context context) {\r
+ public void update(Context context, int noteItemType, String guid) {\r
try {\r
EvernoteUtil util = EvernoteUtil.getInstance();\r
String username = PasswordUtil.getUsername(context);\r
}\r
\r
NoteList noteList;\r
- switch (itemType) {\r
+ switch (noteItemType) {\r
case Constant.NOTE_ITEM_TYPE_NOTE_BOOK:\r
noteList = util.getNoteListByNotebook(guid);\r
break;\r