diff --git a/java/res/layout/candidate.xml b/java/res/layout/candidate.xml index aea34acf1193bd59160c7bd4de1b6452ba7d3aea..aa2845fb4bed4b17c44eda2742ac62d60215537e 100644 --- a/java/res/layout/candidate.xml +++ b/java/res/layout/candidate.xml @@ -24,17 +24,6 @@ android:layout_height="match_parent" android:orientation="horizontal" > - <ImageView - android:id="@+id/candidate_divider" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:src="@drawable/keyboard_suggest_strip_divider" - android:paddingRight="@dimen/candidate_padding" - android:paddingLeft="@dimen/candidate_padding" - android:visibility="invisible" - android:focusable="false" - android:clickable="false" - android:gravity="center_vertical|center_horizontal" /> <Button android:id="@+id/candidate_word" android:layout_width="wrap_content" diff --git a/java/res/layout/candidate_divider.xml b/java/res/layout/candidate_divider.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc6738a4a6fbc59f25e92bf6d58bab11055930a1 --- /dev/null +++ b/java/res/layout/candidate_divider.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2010, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<ImageView + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/candidate_divider" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:src="@drawable/keyboard_suggest_strip_divider" + android:paddingRight="@dimen/candidate_padding" + android:paddingLeft="@dimen/candidate_padding" + android:focusable="false" + android:clickable="false" + android:gravity="center_vertical|center_horizontal" /> diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index abdf30e6bc86f118ceda02b5c507f0355bf02653..6c6eb72bb32a800becf3f0b4071e5b8cdbdaa726 100644 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -16,8 +16,6 @@ package com.android.inputmethod.latin; -import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; - import android.content.Context; import android.content.res.Resources; import android.graphics.Color; @@ -40,11 +38,12 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; +import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; + import java.util.ArrayList; import java.util.List; @@ -57,6 +56,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo private static final boolean DBG = LatinImeLogger.sDBG; private final ArrayList<View> mWords = new ArrayList<View>(); + private final ArrayList<View> mDividers = new ArrayList<View>(); private final boolean mConfigCandidateHighlightFontColorEnabled; private final CharacterStyle mInvertedForegroundColorSpan; private final CharacterStyle mInvertedBackgroundColorSpan; @@ -148,10 +148,11 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo tv.setOnClickListener(this); if (i == 0) tv.setOnLongClickListener(this); - ImageView divider = (ImageView)v.findViewById(R.id.candidate_divider); - // Do not display divider of first candidate. - divider.setVisibility(i == 0 ? INVISIBLE : VISIBLE); mWords.add(v); + if (i > 0) { + View divider = inflater.inflate(R.layout.candidate_divider, null); + mDividers.add(divider); + } } scrollTo(0, getScrollY()); @@ -237,6 +238,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo } else { dv.setVisibility(GONE); } + if (i > 0) + addView(mDividers.get(i - 1)); addView(v); }