import com.yuji.ef.utility.BitmapCacheFactory;
import com.yuji.ef.utility.EvernoteIntentUtil;
import com.yuji.ef.utility.FolderUtil;
+import com.yuji.ef.utility.LockHandler;
+import com.yuji.ef.utility.LockListener;
import com.yuji.ef.utility.ScaleUtil;
-public class EverFolderActivity extends BaseActivity {
+public class EverFolderActivity extends BaseActivity implements LockListener {
private enum ScreenStatus {
Normal, AddNode, DeleteNode, RenameNode
};
private int viewY;
private boolean lock = false;
private boolean isInit = true;
-
+ private boolean isInCycle = false;
+ private boolean isResult = false;
+
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
boolean ret = super.onMenuOpened(featureId, menu);
// #29304
- if (menu == null){
+ if (menu == null) {
return false;
}
-
+
MenuItem item;
boolean cutButtonFlag = false;
// }
updateList(parent, 0);
layout.setMinimumHeight(viewY);
-
+
scrollView.invalidate();
-
-// layout.invalidate();
-// this.runOnUiThread(new Runnable() {
-// @Override
-// public void run() {
-// // ビューを再描画し,UI上で画像変更を反映
-// scrollView.invalidate();
-// }
-// });
+ // layout.invalidate();
+
+ // this.runOnUiThread(new Runnable() {
+ // @Override
+ // public void run() {
+ // // ビューを再描画し,UI上で画像変更を反映
+ // scrollView.invalidate();
+ // }
+ // });
}
-
+
private void updateList(Node node, int depth) {
int N = (int) (bmpWidth * 0.6);
int M = (int) (bmpWidth * 1.2);
NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
for (Long id : idList) {
Node n = dao.searchById(id);
- if (n == null){
+ if (n == null) {
// TODO
continue;
}
- if (n instanceof DirNode){
- DirNode d = (DirNode)n;
- if (isNoteBook(d) && !d.isSelected()){
+ if (n instanceof DirNode) {
+ DirNode d = (DirNode) n;
+ if (isNoteBook(d) && !d.isSelected()) {
continue;
}
}
}
@Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- // updateList();
- // setStatus();
+ public void sendLockResult(boolean b) {
NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
- if (dao.isEmpty()) {
- finish();
- }
- isInit = true;
- }
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
+ if (isResult){
+ if (dao.isEmpty()) {
+ finish();
+ return;
+ }
+ }
+ isResult = false;
+
+
if (dao.isEmpty()) {
if (isInit) {
Intent intent = new Intent(this,
LockDao lockDao = (LockDao) LockDao.getInstance();
lock = lockDao.lock(this, Constant.LOCK_UPDATE_NOTE);
- if (isInit) {
- status = ScreenStatus.Normal;
+ if (isInCycle) {
+ if (isInit) {
+ status = ScreenStatus.Normal;
- if (lock) {
- updateList();
+ if (lock) {
+ layout.setVisibility(View.VISIBLE);
+ updateList();
+ } else {
+ layout.removeAllViews();
+ }
+ setStatus();
+ isInit = false;
} else {
- layout.removeAllViews();
+ setStatus();
}
- setStatus();
- isInit = false;
} else {
+ // TODO
+ // lock解除
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ // TODO sendLockResult()、「lock解除」のため、とりあえずコメント
+ // NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
+ // if (dao.isEmpty()) {
+ // finish();
+ // }
+ isResult = true;
+ isInit = true;
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ isInCycle = true;
+
+ LockHandler handler = new LockHandler();
+ handler.lock(this, Constant.LOCK_UPDATE_NOTE);
+ lock = false;
+
+ if (isInit){
+ layout.setVisibility(View.INVISIBLE);
setStatus();
}
+
+ // NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
+ // if (dao.isEmpty()) {
+ // if (isInit) {
+ // Intent intent = new Intent(this,
+ // (Class<?>) SettingActivity.class);
+ // startActivityForResult(intent, 0);
+ //
+ // isInit = false;
+ // } else {
+ // finish();
+ // isInit = true;
+ // }
+ // }
+ //
+ // LockDao lockDao = (LockDao) LockDao.getInstance();
+ // lock = lockDao.lock(this, Constant.LOCK_UPDATE_NOTE);
+ //
+ // if (isInit) {
+ // status = ScreenStatus.Normal;
+ //
+ // if (lock) {
+ // updateList();
+ // } else {
+ // layout.removeAllViews();
+ // }
+ // setStatus();
+ // isInit = false;
+ // } else {
+ // setStatus();
+ // }
}
@Override
lock = false;
super.onPause();
+ isInCycle = false;
}
private void leftButtonOnClick() {
}
layout.setCutTarget(null, false);
}
-
+
closeIME(v);
-
+
layout.clearTarget();
updateList();
setStatus(ScreenStatus.Normal);
private void msgCancelOnClick(View v) {
closeIME(v);
-
+
setStatus(ScreenStatus.Normal);
}
- private void closeIME(View v){
- InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(v.getWindowToken(),0);
+ private void closeIME(View v) {
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
-
+
public void execute(long srcId, long dstId) {
try {
removeAllNodeView();
e.printStackTrace();
}
}
+
}
\ No newline at end of file