OSDN Git Service

2012/02/16
authorYuji Konishi <yuji.k64613@gmail.com>
Wed, 15 Feb 2012 16:24:18 +0000 (01:24 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Wed, 15 Feb 2012 16:24:18 +0000 (01:24 +0900)
memo.txt
workspace/EverMemo/res/layout/small_list_item_1.xml
workspace/EverMemo/src/com/yuji/em/NoteListViewArrayAdapter.java
workspace/EverMemo/src/com/yuji/em/SelectNoteListActivity.java
workspace/EverMemo/src/com/yuji/em/common/CommonUtil.java
workspace/EverMemo/src/com/yuji/em/common/Constant.java
workspace/EverMemo/src/com/yuji/em/data/NoteDao.java

index 01cc58a..4a37b86 100644 (file)
--- a/memo.txt
+++ b/memo.txt
@@ -2,4 +2,4 @@ http://www.evernote.com/about/developer/api/
 yuji_k64613.a1b6400@sandbox.evernote.com
 https://sandbox.evernote.com/Login.action
 
-git://git.sourceforge.jp/gitroot/evermemo/source.git
+git push yuji_k64613@git.sourceforge.jp:/gitroot/evermemo/source.git master
\ No newline at end of file
index c3436a2..c06f1a2 100755 (executable)
@@ -3,4 +3,5 @@
        android:layout_width="fill_parent"\r
        android:layout_height="wrap_content"\r
        android:gravity="center_vertical"\r
+       android:background="#99cccc"\r
 />\r
index e193986..4d6e0cc 100644 (file)
@@ -13,8 +13,8 @@ import com.evernote.edam.type.Note;
 
 public class NoteListViewArrayAdapter extends ArrayAdapter<NoteListItem> {
        private LayoutInflater inflater;
-       private View headerView = null;
-       private View titleView = null;
+//     private View headerView = null;
+//     private View titleView = null;
 
        public NoteListViewArrayAdapter(Context context, int resourceId,
                        List<NoteListItem> items) {
@@ -45,9 +45,9 @@ public class NoteListViewArrayAdapter extends ArrayAdapter<NoteListItem> {
                return view;
        }
 
-//     @Override
-//     public boolean isEnabled(int position) {
-//             NoteListItem item = getItem(position);
-//             return item.getNote() != null;
-//     }
+       @Override
+       public boolean isEnabled(int position) {
+               NoteListItem item = getItem(position);
+               return item.getNote() != null;
+       }
 }
index 02263fd..53ac354 100644 (file)
@@ -41,7 +41,7 @@ public class SelectNoteListActivity extends Activity {
                                cancelButtonOnClick();
                        }});
                
-               List<Note> list = NoteDao.getInstance().search();
+               List<Note> list = NoteDao.getInstance().search(this);
        }
        
        private void addButtonOnClick(){
index ad44546..da881b3 100644 (file)
@@ -29,6 +29,10 @@ public class CommonUtil {
                }
                return result.toString();
        }
+
+       public static boolean isNull(String str){
+               return str == null || str.length() == 0;
+       }
        
        public static String getUsername(Context context){
                EditPrefUtil pref = new EditPrefUtil(context);  
index 56fb724..7a38f82 100644 (file)
@@ -6,6 +6,7 @@ public class Constant {
        public final static String PREF_PASSWORD = "PASSWORD";
        public final static String PREF_NOTE = "NOTE";
        public final static String PREF_HEADER = "HEADER";
+       public final static String PREF_NOTE_DAO = "NOTE_DAO";
        
        public final static int TOGGLE_SIZE = 5;
 }
index 9f1e760..1fa7fc1 100644 (file)
@@ -3,8 +3,16 @@ package com.yuji.em.data;
 import java.util.ArrayList;
 import java.util.List;
 
+import android.content.Context;
+
+import com.yuji.em.common.CommonUtil;
+import com.yuji.em.common.Constant;
+import com.yuji.em.utility.EditPrefUtil;
+
 public class NoteDao {
+       private static final String DELM = "\t";
        private static NoteDao instance;
+       private int size = Constant.TOGGLE_SIZE;
        
        public static NoteDao getInstance(){
                if (instance == null){
@@ -13,16 +21,36 @@ public class NoteDao {
                return instance;
        }
        
-       public List<Note> search(){
+       public List<Note> search(Context context){
+               EditPrefUtil pref = new EditPrefUtil(context);
+               String data = pref.get(Constant.PREF_NOTE_DAO);
+
+               if (CommonUtil.isNull(data)){
+                       StringBuffer sb = new StringBuffer();
+                       for (int i = 0; i < size; i++){
+                               sb.append("a");
+                               sb.append(DELM);
+                               sb.append("b");
+                               sb.append(DELM);
+                       }
+                       data = sb.toString();
+                       
+                       // TODO
+                       // \95Û\91
+               }
+               
+               String[] strs = data.split("\\t");
+               if (strs.length != size * 2){
+                       return null;
+               }
+               
                List<Note> list = new ArrayList<Note>();
-               Note n;
+               Note n; 
+               for (int i = 0; i < size; i++){
+                       n = new Note(strs[i * 2], strs[i * 2 + 1]);
+                       list.add(n);
+               }
                
-               n = new Note("1", "\83^\83C\83g\83\8bA");
-               list.add(n);
-               n = new Note("1", "\83^\83C\83g\83\8bB");
-               list.add(n);
-               n = new Note("1", "\83^\83C\83g\83\8bC");
-               list.add(n);
                return list;
        }
 }