Merge "Tweak ICS theme a bit"

This commit is contained in:
Tadashi G. Takaoka 2011-07-01 05:12:43 -07:00 committed by Android (Google) Code Review
commit f008ae9ece
20 changed files with 58 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

View file

@ -18,13 +18,10 @@
*/ */
--> -->
<TextView <ImageView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/label_candidate_divider" android:src="@drawable/keyboard_suggest_strip_divider"
android:textSize="@dimen/candidate_text_size"
android:gravity="center"
android:padding="0dp" android:padding="0dp"
android:focusable="false" android:gravity="center" />
android:clickable="false" />

View file

@ -24,5 +24,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="6sp" android:textSize="6sp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:visibility="gone"
style="?attr/suggestionBackgroundStyle" /> style="?attr/suggestionBackgroundStyle" />

View file

@ -27,9 +27,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_weight="1.0" android:layout_weight="1.0"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent" />
>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/candidates_pane_control" android:id="@+id/candidates_pane_control"
android:orientation="horizontal" android:orientation="horizontal"
@ -42,22 +40,22 @@
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:minWidth="30dp"
android:textSize="@dimen/candidate_text_size" android:textSize="@dimen/candidate_text_size"
android:padding="0dp" android:paddingRight="8dp"
android:paddingLeft="8dp"
android:visibility="visible" android:visibility="visible"
style="?attr/suggestionBackgroundStyle" /> android:background="@drawable/btn_keyboard_key_ics" />
<TextView <TextView
android:id="@+id/close_candidates_pane" android:id="@+id/close_candidates_pane"
android:text="@string/label_close_candidates_pane" android:text="@string/label_close_candidates_pane"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:minWidth="30dp"
android:textSize="@dimen/candidate_text_size" android:textSize="@dimen/candidate_text_size"
android:padding="0dp" android:paddingRight="8dp"
android:paddingLeft="8dp"
android:visibility="gone" android:visibility="gone"
style="?attr/suggestionBackgroundStyle" /> android:background="@drawable/btn_keyboard_key_ics" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/touch_to_save" android:id="@+id/touch_to_save"

View file

@ -57,7 +57,7 @@
<dimen name="key_preview_offset_ics">0.01in</dimen> <dimen name="key_preview_offset_ics">0.01in</dimen>
<dimen name="candidate_strip_height">38dip</dimen> <dimen name="candidate_strip_height">36dip</dimen>
<dimen name="candidate_strip_fading_edge_length">63dip</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen>
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
<!-- popup_key_height x 1.2 --> <!-- popup_key_height x 1.2 -->

View file

@ -68,7 +68,7 @@
<dimen name="key_preview_height_ics">15.0mm</dimen> <dimen name="key_preview_height_ics">15.0mm</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen>
<dimen name="candidate_strip_height">46dip</dimen> <dimen name="candidate_strip_height">44dip</dimen>
<dimen name="candidate_strip_padding">15.0mm</dimen> <dimen name="candidate_strip_padding">15.0mm</dimen>
<dimen name="candidate_min_width">0.3in</dimen> <dimen name="candidate_min_width">0.3in</dimen>
<dimen name="candidate_padding">12dip</dimen> <dimen name="candidate_padding">12dip</dimen>

View file

@ -69,7 +69,7 @@
<dimen name="key_preview_height_ics">15.0mm</dimen> <dimen name="key_preview_height_ics">15.0mm</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen>
<dimen name="candidate_strip_height">46dip</dimen> <dimen name="candidate_strip_height">44dip</dimen>
<!-- candidate_strip_minimum_height = <!-- candidate_strip_minimum_height =
key_preview_height_holo - key_preview_offset_holo + alpha --> key_preview_height_holo - key_preview_offset_holo + alpha -->
<dimen name="candidate_strip_minimum_height">18mm</dimen> <dimen name="candidate_strip_minimum_height">18mm</dimen>

View file

@ -120,7 +120,6 @@
<attr name="colorTypedWord" format="color" /> <attr name="colorTypedWord" format="color" />
<attr name="colorAutoCorrect" format="color" /> <attr name="colorAutoCorrect" format="color" />
<attr name="colorSuggested" format="color" /> <attr name="colorSuggested" format="color" />
<attr name="colorDivider" format="color" />
<attr name="candidateCountInStrip" format="integer" /> <attr name="candidateCountInStrip" format="integer" />
</declare-styleable> </declare-styleable>

View file

@ -73,7 +73,7 @@
<dimen name="key_preview_height_ics">80sp</dimen> <dimen name="key_preview_height_ics">80sp</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen>
<dimen name="candidate_strip_height">42dip</dimen> <dimen name="candidate_strip_height">40dip</dimen>
<!-- candidate_strip_minimum_height = <!-- candidate_strip_minimum_height =
key_preview_height_holo - key_preview_offset_holo + alpha --> key_preview_height_holo - key_preview_offset_holo + alpha -->
<dimen name="candidate_strip_minimum_height">100sp</dimen> <dimen name="candidate_strip_minimum_height">100sp</dimen>

View file

@ -50,7 +50,7 @@
<item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item> <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item>
<item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item> <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item>
<!-- LatinKeyboard icons --> <!-- LatinKeyboard icons -->
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
</resources> </resources>

View file

@ -92,7 +92,6 @@
<item name="colorTypedWord">#FFFFFFFF</item> <item name="colorTypedWord">#FFFFFFFF</item>
<item name="colorAutoCorrect">#FFFCAE00</item> <item name="colorAutoCorrect">#FFFCAE00</item>
<item name="colorSuggested">#FFFCAE00</item> <item name="colorSuggested">#FFFCAE00</item>
<item name="colorDivider">#20FFFFFF</item>
<item name="candidateCountInStrip">@integer/candidate_count_in_strip</item> <item name="candidateCountInStrip">@integer/candidate_count_in_strip</item>
</style> </style>
<!-- Theme "Basic high contrast" --> <!-- Theme "Basic high contrast" -->
@ -191,9 +190,8 @@
<style name="CandidateViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich"> <style name="CandidateViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich">
<item name="autoCorrectHighlight">autoCorrectBold|autoCorrectInvert</item> <item name="autoCorrectHighlight">autoCorrectBold|autoCorrectInvert</item>
<item name="colorTypedWord">#FFFFFFFF</item> <item name="colorTypedWord">#FFFFFFFF</item>
<item name="colorAutoCorrect">#FFFFFFFF</item> <item name="colorAutoCorrect">#FF3DC8FF</item>
<item name="colorSuggested">#FFFFFFFF</item> <item name="colorSuggested">#FFFFFFFF</item>
<item name="colorDivider">#20FFFFFF</item>
<item name="candidateCountInStrip">@integer/candidate_count_in_strip</item> <item name="candidateCountInStrip">@integer/candidate_count_in_strip</item>
</style> </style>
<style name="PopupMiniKeyboardAnimation"> <style name="PopupMiniKeyboardAnimation">

View file

@ -394,6 +394,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
public int mKeyLetterSize; public int mKeyLetterSize;
public final int[] mCoordinates = new int[2]; public final int[] mCoordinates = new int[2];
private static final int PREVIEW_ALPHA = 240;
public KeyPreviewDrawParams(TypedArray a, KeyDrawParams keyDrawParams) { public KeyPreviewDrawParams(TypedArray a, KeyDrawParams keyDrawParams) {
mPreviewBackground = a.getDrawable(R.styleable.KeyboardView_keyPreviewBackground); mPreviewBackground = a.getDrawable(R.styleable.KeyboardView_keyPreviewBackground);
mPreviewLeftBackground = a.getDrawable( mPreviewLeftBackground = a.getDrawable(
@ -402,6 +404,9 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
R.styleable.KeyboardView_keyPreviewRightBackground); R.styleable.KeyboardView_keyPreviewRightBackground);
mPreviewSpacebarBackground = a.getDrawable( mPreviewSpacebarBackground = a.getDrawable(
R.styleable.KeyboardView_keyPreviewSpacebarBackground); R.styleable.KeyboardView_keyPreviewSpacebarBackground);
setAlpha(mPreviewBackground, PREVIEW_ALPHA);
setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA);
setAlpha(mPreviewRightBackground, PREVIEW_ALPHA);
mPreviewOffset = a.getDimensionPixelOffset( mPreviewOffset = a.getDimensionPixelOffset(
R.styleable.KeyboardView_keyPreviewOffset, 0); R.styleable.KeyboardView_keyPreviewOffset, 0);
mPreviewHeight = a.getDimensionPixelSize( mPreviewHeight = a.getDimensionPixelSize(
@ -417,6 +422,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio); mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio);
mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio);
} }
private static void setAlpha(Drawable drawable, int alpha) {
if (drawable == null)
return;
drawable.setAlpha(alpha);
}
} }
public KeyboardView(Context context, AttributeSet attrs) { public KeyboardView(Context context, AttributeSet attrs) {

View file

@ -61,8 +61,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan(); private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan();
// The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}. // The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}.
private static final int MAX_SUGGESTIONS = 18; private static final int MAX_SUGGESTIONS = 18;
private static final int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT;
private static final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT; private static final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;
private static final int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT;
private static final boolean DBG = LatinImeLogger.sDBG; private static final boolean DBG = LatinImeLogger.sDBG;
@ -90,7 +90,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
private final int mColorTypedWord; private final int mColorTypedWord;
private final int mColorAutoCorrect; private final int mColorAutoCorrect;
private final int mColorSuggestedCandidate; private final int mColorSuggestedCandidate;
private final int mColorDivider;
private final PopupWindow mPreviewPopup; private final PopupWindow mPreviewPopup;
private final TextView mPreviewText; private final TextView mPreviewText;
@ -184,6 +183,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
final float textSize = res.getDimension(R.dimen.candidate_text_size); final float textSize = res.getDimension(R.dimen.candidate_text_size);
mPaint.setTextSize(textSize); mPaint.setTextSize(textSize);
mPadding = res.getDimensionPixelSize(R.dimen.candidate_padding); mPadding = res.getDimensionPixelSize(R.dimen.candidate_padding);
divider.measure(WRAP_CONTENT, MATCH_PARENT);
mDividerWidth = divider.getMeasuredWidth(); mDividerWidth = divider.getMeasuredWidth();
mDividerHeight = divider.getMeasuredHeight(); mDividerHeight = divider.getMeasuredHeight();
mControlWidth = control.getMeasuredWidth(); mControlWidth = control.getMeasuredWidth();
@ -295,7 +295,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0); mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0);
mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0); mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0);
mColorSuggestedCandidate = a.getColor(R.styleable.CandidateView_colorSuggested, 0); mColorSuggestedCandidate = a.getColor(R.styleable.CandidateView_colorSuggested, 0);
mColorDivider = a.getColor(R.styleable.CandidateView_colorDivider, 0);
mCandidateCountInStrip = a.getInt( mCandidateCountInStrip = a.getInt(
R.styleable.CandidateView_candidateCountInStrip, DEFAULT_CANDIDATE_COUNT_IN_STRIP); R.styleable.CandidateView_candidateCountInStrip, DEFAULT_CANDIDATE_COUNT_IN_STRIP);
a.recycle(); a.recycle();
@ -321,7 +320,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
word.setOnLongClickListener(this); word.setOnLongClickListener(this);
mWords.add(word); mWords.add(word);
mInfos.add((TextView)inflater.inflate(R.layout.candidate_info, null)); mInfos.add((TextView)inflater.inflate(R.layout.candidate_info, null));
mDividers.add(getDivider(inflater)); mDividers.add(inflater.inflate(R.layout.candidate_divider, null));
} }
mTouchToSave = findViewById(R.id.touch_to_save); mTouchToSave = findViewById(R.id.touch_to_save);
@ -333,6 +332,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
mCandidatesPaneControl = (ViewGroup)findViewById(R.id.candidates_pane_control); mCandidatesPaneControl = (ViewGroup)findViewById(R.id.candidates_pane_control);
mExpandCandidatesPane = (TextView)findViewById(R.id.expand_candidates_pane); mExpandCandidatesPane = (TextView)findViewById(R.id.expand_candidates_pane);
mExpandCandidatesPane.getBackground().setAlpha(180);
mExpandCandidatesPane.setOnClickListener(new OnClickListener() { mExpandCandidatesPane.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -340,6 +340,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
} }
}); });
mCloseCandidatesPane = (TextView)findViewById(R.id.close_candidates_pane); mCloseCandidatesPane = (TextView)findViewById(R.id.close_candidates_pane);
mCloseCandidatesPane.getBackground().setAlpha(180);
mCloseCandidatesPane.setOnClickListener(new OnClickListener() { mCloseCandidatesPane.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -348,15 +349,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
}); });
mCandidatesPaneControl.measure(WRAP_CONTENT, WRAP_CONTENT); mCandidatesPaneControl.measure(WRAP_CONTENT, WRAP_CONTENT);
mParams = new CandidateViewLayoutParams(res, mDividers.get(0), mCandidatesPaneControl, mParams = new CandidateViewLayoutParams(
mAutoCorrectHighlight); res, mDividers.get(0), mCandidatesPaneControl, mAutoCorrectHighlight);
}
private View getDivider(LayoutInflater inflater) {
final TextView divider = (TextView)inflater.inflate(R.layout.candidate_divider, null);
divider.setTextColor(mColorDivider);
divider.measure(WRAP_CONTENT, WRAP_CONTENT);
return divider;
} }
/** /**
@ -429,7 +423,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
? PUNCTUATIONS_IN_STRIP : mCandidateCountInStrip); ? PUNCTUATIONS_IN_STRIP : mCandidateCountInStrip);
final int count = Math.min(mWords.size(), suggestions.size()); final int count = Math.min(mWords.size(), suggestions.size());
if (count <= params.mCountInStrip) { if (count <= params.mCountInStrip && !DBG) {
mCandidatesPaneControl.setVisibility(GONE); mCandidatesPaneControl.setVisibility(GONE);
} else { } else {
mCandidatesPaneControl.setVisibility(VISIBLE); mCandidatesPaneControl.setVisibility(VISIBLE);
@ -437,8 +431,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
} }
final int countInStrip = params.mCountInStrip; final int countInStrip = params.mCountInStrip;
int fromIndex = countInStrip; View centeringFrom = null, lastView = null;
int x = 0, y = 0; int x = 0, y = 0, infoX = 0;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
final int pos; final int pos;
if (i <= 1) { if (i <= 1) {
@ -497,18 +491,18 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
} }
mCandidatesStrip.addView(word); mCandidatesStrip.addView(word);
if (params.mCanUseFixedWidthColumns) { if (params.mCanUseFixedWidthColumns) {
setLayoutWeight(word, 1.0f); setLayoutWeight(word, 1.0f, mCandidateStripHeight);
} else { } else {
final int width = getTextWidth(text, paint) + params.mPadding * 2; final int width = getTextWidth(text, paint) + params.mPadding * 2;
setLayoutWeight(word, width); setLayoutWeight(word, width, mCandidateStripHeight);
} }
if (info != null) { if (info != null) {
word.measure(WRAP_CONTENT, MATCH_PARENT); mCandidatesPane.addView(info);
final int width = word.getMeasuredWidth();
info.measure(WRAP_CONTENT, WRAP_CONTENT); info.measure(WRAP_CONTENT, WRAP_CONTENT);
final int infoWidth = info.getMeasuredWidth(); final int width = info.getMeasuredWidth();
FrameLayoutCompatUtils.placeViewAt( y = info.getMeasuredHeight();
info, width - infoWidth, 0, infoWidth, info.getMeasuredHeight()); FrameLayoutCompatUtils.placeViewAt(info, infoX, 0, width, y);
infoX += width * 2;
} }
} else { } else {
paint.setTextScaleX(1.0f); paint.setTextScaleX(1.0f);
@ -516,10 +510,9 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
int available = paneWidth - x - params.mPadding * 2; int available = paneWidth - x - params.mPadding * 2;
if (textWidth >= available) { if (textWidth >= available) {
// Needs new row, centering previous row. // Needs new row, centering previous row.
centeringCandidates(fromIndex, i - 1, x, paneWidth); centeringCandidates(centeringFrom, lastView, x, paneWidth);
x = 0; x = 0;
y += mCandidateStripHeight; y += mCandidateStripHeight;
fromIndex = i;
} }
if (x != 0) { if (x != 0) {
// Add divider if this isn't the left most suggestion in current row. // Add divider if this isn't the left most suggestion in current row.
@ -536,46 +529,45 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
word.setText(text); word.setText(text);
word.setTextScaleX(scaleX); word.setTextScaleX(scaleX);
mCandidatesPane.addView(word); mCandidatesPane.addView(word);
word.measure(WRAP_CONTENT, WRAP_CONTENT); lastView = word;
if (x == 0) centeringFrom = word;
word.measure(WRAP_CONTENT,
MeasureSpec.makeMeasureSpec(mCandidateStripHeight, MeasureSpec.EXACTLY));
final int width = word.getMeasuredWidth(); final int width = word.getMeasuredWidth();
final int height = word.getMeasuredHeight(); final int height = word.getMeasuredHeight();
FrameLayoutCompatUtils.placeViewAt( FrameLayoutCompatUtils.placeViewAt(
word, x, y + (mCandidateStripHeight - height) / 2, width, height); word, x, y + (mCandidateStripHeight - height) / 2, width, height);
x += width;
if (info != null) { if (info != null) {
mCandidatesPane.addView(info); mCandidatesPane.addView(info);
lastView = info;
info.measure(WRAP_CONTENT, WRAP_CONTENT); info.measure(WRAP_CONTENT, WRAP_CONTENT);
final int infoWidth = info.getMeasuredWidth(); final int infoWidth = info.getMeasuredWidth();
FrameLayoutCompatUtils.placeViewAt( FrameLayoutCompatUtils.placeViewAt(
info, x + width - infoWidth, y, infoWidth, info.getMeasuredHeight()); info, x - infoWidth, y, infoWidth, info.getMeasuredHeight());
} }
x += width;
} }
} }
if (x != 0) { if (x != 0) {
// Centering last candidates row. // Centering last candidates row.
centeringCandidates(fromIndex, count - 1, x, paneWidth); centeringCandidates(centeringFrom, lastView, x, paneWidth);
} }
} }
private static void setLayoutWeight(View v, float weight) { private static void setLayoutWeight(View v, float weight, int height) {
final ViewGroup.LayoutParams lp = v.getLayoutParams(); final ViewGroup.LayoutParams lp = v.getLayoutParams();
if (lp instanceof LinearLayout.LayoutParams) { if (lp instanceof LinearLayout.LayoutParams) {
final LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams)lp; final LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams)lp;
llp.weight = weight; llp.weight = weight;
llp.width = 0; llp.width = 0;
llp.height = MATCH_PARENT; llp.height = height;
} }
} }
private void centeringCandidates(int from, int to, int width, int paneWidth) { private void centeringCandidates(View from, View to, int width, int paneWidth) {
final ViewGroup pane = mCandidatesPane; final ViewGroup pane = mCandidatesPane;
final int fromIndex = pane.indexOfChild(mWords.get(from)); final int fromIndex = pane.indexOfChild(from);
final int toIndex; final int toIndex = pane.indexOfChild(to);
if (mInfos.get(to).getParent() != null) {
toIndex = pane.indexOfChild(mInfos.get(to));
} else {
toIndex = pane.indexOfChild(mWords.get(to));
}
final int offset = (paneWidth - width) / 2; final int offset = (paneWidth - width) / 2;
for (int index = fromIndex; index <= toIndex; index++) { for (int index = fromIndex; index <= toIndex; index++) {
offsetMargin(pane.getChildAt(index), offset, 0); offsetMargin(pane.getChildAt(index), offset, 0);