OSDN Git Service

(no commit message)
authorHiromitsu Shioya <hiroshica@gmail.com>
Sun, 6 Dec 2009 09:15:41 +0000 (18:15 +0900)
committerHiromitsu Shioya <hiroshica@gmail.com>
Sun, 6 Dec 2009 09:15:41 +0000 (18:15 +0900)
src/com/hiroshica/android/input/nicownn2/TextCandidatesViewManager.java

index c06fce2..a3a9f35 100644 (file)
@@ -115,6 +115,7 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
        /** get last id of topline */
        private int mToplineLastId;
 
+       private int mTotalLastId;
     /** List of candidates */
     private ArrayList<WnnWord> mWnnWordArray;
 
@@ -133,6 +134,8 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
     /** {@code true} if the full screen mode is selected */
     private boolean mIsFullView = false;
 
+       private boolean mIsCreateFullView = false;
+
     /** The event object for "touch" */
     private MotionEvent mMotionEvent = null;
 
@@ -393,10 +396,15 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
         boolean readMore = setViewLayout(type);
 
         if (readMore) {
-            displayCandidates(this.mConverter, false, -1);
+                       if (false == mIsCreateFullView) {
+                               displayCandidates(this.mConverter, false, -1);
+                               mIsCreateFullView = true;
+                       }
+                       else{
+                               visibleFullCandidate();
+                       }
         } else { 
             if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) {
-                               //clearNormalCandidates();
                 mIsFullView = false;
                 if (mDisplayEndOffset > 0) {
                     int maxLine = getMaxLine();
@@ -427,6 +435,7 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
             return false;
 
         case CandidatesViewManager.VIEW_TYPE_NORMAL:
+                       clearNormalCandidates();
             mViewBodyScroll.scrollTo(0, 0);
             mViewCandidateList2nd.setVisibility(View.VISIBLE);
             mViewCandidateBase.setMinimumHeight(-1);
@@ -465,10 +474,10 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
         mFullViewPrevLineTopId = 0;
         mCreateCandidateDone = false;
         mNormalViewWordCountOfLine = 0;
+               mIsCreateFullView = false;
 
         clearCandidates();
         mConverter = converter;
-               //converter.resetCandidate();
 
                setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
 
@@ -604,6 +613,7 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
                checkImageSpan(textView, word);
         mWnnWordArray.add(mWordCount, word);
         mWordCount++;
+               mTotalLastId = textId;
 
                if (FULL_VIEW_DIV < (mFullViewOccupyCount + occupyCount)) {
                        if (FULL_VIEW_DIV != mFullViewOccupyCount) {
@@ -668,6 +678,7 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
         mLineCount = 1;
         mWordCount = 0;
                mToplineLastId = 0;
+               mTotalLastId   = 0;
         mWnnWordArray.clear();
 
         mLineLength = 0;
@@ -685,18 +696,35 @@ public class TextCandidatesViewManager implements CandidatesViewManager, Gesture
     }
        /** clear normalCandidate */
     private void clearNormalCandidates() {
-               if (false == mIsFullView) {
+               if (false == mIsCreateFullView) {
                        return;
                }
         RelativeLayout layout = mViewCandidateList2nd;
         int size = layout.getChildCount();
-        for (int i = mToplineLastId + 1; i < size; i++) {
+        for (int i = mToplineLastId; i < size; i++) {
             View v = layout.getChildAt(i);
             v.setVisibility(View.GONE);
         }
-               if (size > mToplineLastId) {
+               if (mTotalLastId > mToplineLastId) {
                        mCanReadMore = true;
-                       mLineCount = getMaxLine() + 1;
+               }
+       }
+       /** view fullCandidate */
+       private void visibleFullCandidate() {
+               if (false == mIsCreateFullView) {
+                       return;
+               }
+        RelativeLayout layout = mViewCandidateList2nd;
+        int size = layout.getChildCount();
+               if (size > mTotalLastId) {
+                       size = mTotalLastId;
+               }
+        for (int i = 0; i < size; i++) {
+            View v = layout.getChildAt(i);
+            v.setVisibility(View.VISIBLE);
+        }
+               if (mTotalLastId != 0) {
+                       mCanReadMore = false;
                }
        }
        /** clear FullCandidate */