mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Separate leftward arrow from "add to dictionary" hint text
Bug: 6008875 Change-Id: I2be1698e485bc6541163771f41b8b82eaa3cee7a
This commit is contained in:
parent
fc50a41078
commit
2eb8781dc2
36
java/res/layout/hint_add_to_dictionary.xml
Normal file
36
java/res/layout/hint_add_to_dictionary.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2012, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- This is derived from suggestion_word.xml without minWidth attribute and padding -->
|
||||||
|
<TextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textSize="@dimen/suggestion_text_size"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingLeft="0dp"
|
||||||
|
android:paddingTop="0dp"
|
||||||
|
android:paddingRight="0dp"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
android:focusable="false"
|
||||||
|
android:clickable="false"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="none"
|
||||||
|
style="?attr/suggestionBackgroundStyle" />
|
@ -307,7 +307,7 @@
|
|||||||
<string name="select_language">Input languages</string>
|
<string name="select_language">Input languages</string>
|
||||||
|
|
||||||
<!-- Add to dictionary hint -->
|
<!-- Add to dictionary hint -->
|
||||||
<string name="hint_add_to_dictionary">← Touch again to save</string>
|
<string name="hint_add_to_dictionary">Touch again to save</string>
|
||||||
|
|
||||||
<!-- Inform the user that a particular language has an available dictionary -->
|
<!-- Inform the user that a particular language has an available dictionary -->
|
||||||
<string name="has_dictionary">Dictionary available</string>
|
<string name="has_dictionary">Dictionary available</string>
|
||||||
|
@ -155,6 +155,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
|||||||
private final int mCenterSuggestionIndex;
|
private final int mCenterSuggestionIndex;
|
||||||
private final Drawable mMoreSuggestionsHint;
|
private final Drawable mMoreSuggestionsHint;
|
||||||
private static final String MORE_SUGGESTIONS_HINT = "\u2026";
|
private static final String MORE_SUGGESTIONS_HINT = "\u2026";
|
||||||
|
private static final String LEFTWARDS_ARROW = "\u2190";
|
||||||
|
|
||||||
private static final CharacterStyle BOLD_SPAN = new StyleSpan(Typeface.BOLD);
|
private static final CharacterStyle BOLD_SPAN = new StyleSpan(Typeface.BOLD);
|
||||||
private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan();
|
private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan();
|
||||||
@ -169,6 +170,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
|||||||
public boolean mMoreSuggestionsAvailable;
|
public boolean mMoreSuggestionsAvailable;
|
||||||
|
|
||||||
public final TextView mWordToSaveView;
|
public final TextView mWordToSaveView;
|
||||||
|
private final TextView mLeftwardsArrowView;
|
||||||
private final TextView mHintToSaveView;
|
private final TextView mHintToSaveView;
|
||||||
|
|
||||||
public SuggestionsViewParams(Context context, AttributeSet attrs, int defStyle,
|
public SuggestionsViewParams(Context context, AttributeSet attrs, int defStyle,
|
||||||
@ -231,7 +233,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
|||||||
|
|
||||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
mWordToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
|
mWordToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
|
||||||
mHintToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
|
mLeftwardsArrowView = (TextView)inflater.inflate(R.layout.hint_add_to_dictionary, null);
|
||||||
|
mHintToSaveView = (TextView)inflater.inflate(R.layout.hint_add_to_dictionary, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxMoreSuggestionsRow() {
|
public int getMaxMoreSuggestionsRow() {
|
||||||
@ -488,9 +491,15 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
|||||||
|
|
||||||
stripView.addView(mDividers.get(0));
|
stripView.addView(mDividers.get(0));
|
||||||
|
|
||||||
|
final TextView leftArrowView = mLeftwardsArrowView;
|
||||||
|
leftArrowView.setTextColor(mColorAutoCorrect);
|
||||||
|
leftArrowView.setText(LEFTWARDS_ARROW);
|
||||||
|
stripView.addView(leftArrowView);
|
||||||
|
|
||||||
final TextView hintView = mHintToSaveView;
|
final TextView hintView = mHintToSaveView;
|
||||||
|
hintView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
|
||||||
hintView.setTextColor(mColorAutoCorrect);
|
hintView.setTextColor(mColorAutoCorrect);
|
||||||
final int hintWidth = width - wordWidth;
|
final int hintWidth = width - wordWidth - leftArrowView.getWidth();
|
||||||
final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint());
|
final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint());
|
||||||
hintView.setText(hintText);
|
hintView.setText(hintText);
|
||||||
hintView.setTextScaleX(hintScaleX);
|
hintView.setTextScaleX(hintScaleX);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user