OSDN Git Service

FOO
authorYuji Konishi <yuji.k64613@gmail.com>
Thu, 20 Sep 2012 14:08:20 +0000 (23:08 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Thu, 20 Sep 2012 14:08:20 +0000 (23:08 +0900)
source/workspace/EverFolder/src/com/yuji/ef/IconFrameLayout.java
source/workspace/EverFolder/src/com/yuji/ef/exception/EfError.java
source/workspace/EverFolder/src/com/yuji/ef/service/NoteUpdatorService.java
source/workspace/EverFolder/src/com/yuji/ef/task/NoteUpdateTask.java
source/workspace/EverFolder/src/com/yuji/ef/utility/FolderUtil.java

index 4725643..39ad591 100644 (file)
@@ -360,14 +360,20 @@ public class IconFrameLayout extends FrameLayout implements OnLongClickListener
 
                                        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);
                                        }
 
@@ -430,6 +436,7 @@ public class IconFrameLayout extends FrameLayout implements OnLongClickListener
 
                        return super.onTouchEvent(event);
                } catch (Exception e) {
+                       // TODO
                        e.printStackTrace();
                        return false;
                }
index 01f96e9..0912fcd 100644 (file)
@@ -6,6 +6,7 @@ public enum EfError {
        INIT,
        NOT_FOUND,
        NO_LOGIN,       
+       NETWORK,
        
        SYSTEM,
 }
index 7e8b5b3..4e655f2 100644 (file)
@@ -17,7 +17,9 @@ import com.yuji.ef.R;
 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;
@@ -88,6 +90,17 @@ public class NoteUpdatorService extends Service {
                                                                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
index ff59488..22e0f42 100644 (file)
@@ -36,7 +36,13 @@ public class NoteUpdateTask implements AsyncTaskIF {
                        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();
index 3b44f5f..99968b6 100644 (file)
@@ -36,10 +36,14 @@ public class FolderUtil {
 
        }
 
+       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;
@@ -69,7 +73,7 @@ public class FolderUtil {
                // 削除
                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;
@@ -114,7 +118,7 @@ public class FolderUtil {
                        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);
                }
@@ -187,7 +191,7 @@ public class FolderUtil {
        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());