OSDN Git Service

T29700
authorYuji Konishi <yuji.k64613@gmail.com>
Sat, 29 Sep 2012 06:02:24 +0000 (15:02 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Sat, 29 Sep 2012 06:02:24 +0000 (15:02 +0900)
source/workspace/EverFolder/src/com/yuji/ef/EverFolderActivity.java
source/workspace/EverFolder/src/com/yuji/ef/OAuthActivity.java
source/workspace/EverFolder/src/com/yuji/ef/SettingActivity.java
source/workspace/EverFolder/src/com/yuji/ef/service/NoteUpdatorService.java
source/workspace/EverFolder/src/com/yuji/ef/utility/EvernoteUtil.java

index 345c9dc..48effbc 100644 (file)
@@ -88,9 +88,11 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
                        String action = intent.getAction();
 
                        if (action.equals(Constant.ACTION_MESSAGE)) {
-                               String msg = intent
-                                               .getStringExtra(Constant.ACTION_MESSAGE_MESSAGE);
-                               EfException.msg(EverFolderActivity.this, msg);
+                               if (isInCycle){
+                                       String msg = intent
+                                                       .getStringExtra(Constant.ACTION_MESSAGE_MESSAGE);
+                                       EfException.msg(EverFolderActivity.this, msg);
+                               }
                        } else if (action.equals(Constant.ACTION_UPDATE)) {
                                if (isInCycle && !lock) {
                                        LockDao lockDao = (LockDao) LockDao.getInstance();
index 489cd16..699f65d 100644 (file)
@@ -127,10 +127,13 @@ public class OAuthActivity extends BaseActivity {
                if (isInit) {
                        isInit = false;
                } else {
+                       EvernoteUtil.getInstance().setSession(util.getSession());
                        if (isCompleteAuth) {
-                               EvernoteUtil.getInstance().setSession(util.getSession());
                                util.setLoginTime(this);
                        }
+                       else {
+                               util.logout(this);
+                       }
                        finish();
                }
        }
@@ -210,4 +213,4 @@ public class OAuthActivity extends BaseActivity {
        // return new File(Environment.getExternalStorageDirectory(),
        // APP_DATA_PATH);
        // }
-}
\ No newline at end of file
+}
index ae63d39..744477d 100644 (file)
@@ -67,9 +67,11 @@ public class SettingActivity extends BaseActivity implements LockListener {
                        String action = intent.getAction();
 
                        if (action.equals(Constant.ACTION_MESSAGE)) {
-                               String msg = intent
-                                               .getStringExtra(Constant.ACTION_MESSAGE_MESSAGE);
-                               EfException.msg(SettingActivity.this, msg);
+                               if (isInCycle){
+                                       String msg = intent
+                                                       .getStringExtra(Constant.ACTION_MESSAGE_MESSAGE);
+                                       EfException.msg(SettingActivity.this, msg);
+                               }
                        } else if (action.equals(Constant.ACTION_UPDATE)) {
                                if (isInCycle && !lock) {
                                        LockDao lockDao = (LockDao) LockDao.getInstance();
index 4acd008..3fb40c2 100644 (file)
@@ -215,8 +215,8 @@ public class NoteUpdatorService extends Service {
                }
 
                Calendar cal = Calendar.getInstance();
-               cal.add(Calendar.HOUR, (int) updateTime);
-               //cal.add(Calendar.SECOND, (int) 15); // TODO
+               //cal.add(Calendar.HOUR, (int) updateTime);
+               cal.add(Calendar.SECOND, 180); // TODO
 
                long t = cal.getTimeInMillis();
                PendingIntent alarmSender = PendingIntent.getService(context, 0,
index 83d971e..95dc81c 100644 (file)
@@ -296,6 +296,9 @@ public class EvernoteUtil {
        private String getAuthenticationToken() {
                if (authenticationToken == null) {
                        authenticationToken = session.getAuthToken();
+                       if (authenticationToken == null) {
+                               return null;
+                       }
                        try {
                                noteStore = session.createNoteStore();
                        } catch (TTransportException e) {
@@ -431,4 +434,4 @@ public class EvernoteUtil {
 //             return false;
                return true;
        }
-}
\ No newline at end of file
+}