if (selectedTarget != null && selectedTarget == target) {
long id = selectedTarget.getNodeId();
-
+ boolean isDirNode = target.getStatusImageView() != null;
+
clearColorFilter(target);
setTarget(null);
setSelectedTarget(null);
activity.targetSelectedChanged(true);
- activity.executeView(id);
-
+ if (isDirNode){
+ activity.execute(id);
+ }
+ else {
+ activity.executeView(id);
+ }
+
return super.onTouchEvent(event);
}
return super.onTouchEvent(event);
} catch (Exception e) {
+ // TODO
e.printStackTrace();
return false;
}
INIT,
NOT_FOUND,
NO_LOGIN,
+ NETWORK,
SYSTEM,
}
import com.yuji.ef.SettingActivity;
import com.yuji.ef.common.Constant;
import com.yuji.ef.dao.LockDao;
+import com.yuji.ef.exception.EfError;
import com.yuji.ef.exception.EfException;
+import com.yuji.ef.exception.RollbackException;
import com.yuji.ef.pref.EditPrefUtil;
import com.yuji.ef.task.NoteUpdateTask;
import com.yuji.ef.utility.DateUtil;
updateDate(NoteUpdatorService.this
.getString(R.string.serviceUpdateReferenceDataMsg));
}
+ } catch (RollbackException e) {
+ // TODO
+ Debug.d(this, null, e);
+ if (e.getError() == EfError.NETWORK){
+ // TODO
+ updateDate("ネットワークエラー");
+ }
+ else {
+ updateDate(NoteUpdatorService.this
+ .getString(R.string.serviceUpdateUnexpectedErrorkMsg));
+ }
} catch (Exception e) {
Debug.d(this, null, e);
updateDate(NoteUpdatorService.this
FolderUtil util = FolderUtil.getInstance();
util.update(isRoot, isBook, isNote);
} catch (RollbackException e) {
- EfException.msg(com.yuji.ef.R.string.ErrorUpdate);
+ if (e.getError() == EfError.NETWORK){
+ // TODO
+ EfException.msg(com.yuji.ef.R.string.ErrorUpdate);
+ }
+ else {
+ EfException.msg(com.yuji.ef.R.string.ErrorUpdate);
+ }
Debug.d(this, null, e);
LockDao lockDao = (LockDao) LockDao.getInstance();
}
+ private EfError getErrorId(EvernoteUtil.Error err){
+ return (err == EvernoteUtil.Error.CONNECT)? EfError.NETWORK : EfError.SYSTEM;
+ }
+
public void updateNotebook(SQLiteDatabase db, List<Long> removeList) throws RollbackException {
List<Notebook> noteBookList = util.getNoteBookList();
if (noteBookList == null){
- throw new RollbackException(EfError.SYSTEM);
+ throw new RollbackException(getErrorId(util.getErrorCode()));
}
long id;
// 削除
List<Node> list = nodeDao.searchBook(db);
if (list == null){
- throw new RollbackException(EfError.SYSTEM);
+ throw new RollbackException(getErrorId(util.getErrorCode()));
}
for (Node node : list) {
boolean isFound = false;
String guid = node.getGuid();
List<NoteList> noteListList = util.getNoteListByNotebook(guid);
if (noteListList == null){
- throw new RollbackException(EfError.SYSTEM);
+ throw new RollbackException(getErrorId(util.getErrorCode()));
}
updateNote(db, noteListList);
}
private void deleteNode(SQLiteDatabase db) throws RollbackException {
List<Node> list = nodeDao.searchNoteByFlag(db, 0);
if (list == null){
- throw new RollbackException(EfError.SYSTEM);
+ throw new RollbackException(getErrorId(util.getErrorCode()));
}
for (Node node : list) {
nodeDao.deleteNT(node.getId());