Make the layout of the add word dialog easier to understand
Change-Id: I1a71d5c95c142655219c7ab3ae4f67fa0b1f3d1a
This commit is contained in:
@@ -37,47 +37,60 @@
|
|||||||
android:background="@android:color/holo_blue_light" />
|
android:background="@android:color/holo_blue_light" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText android:id="@+id/user_dictionary_add_word_text"
|
<GridLayout android:id="@+id/user_dictionary_add_word_grid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical|left"
|
|
||||||
android:inputType="textNoSuggestions"
|
|
||||||
android:imeOptions="flagNoFullscreen"
|
|
||||||
android:paddingBottom="10dip"
|
|
||||||
android:layout_marginLeft="8dip"
|
android:layout_marginLeft="8dip"
|
||||||
android:layout_marginRight="8dip"
|
android:layout_marginRight="8dip"
|
||||||
android:visibility="visible">
|
android:columnCount="2">
|
||||||
|
<TextView android:id="@+id/user_dictionary_add_word_label"
|
||||||
|
style="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left|center_vertical"
|
||||||
|
android:text="@string/user_dict_settings_add_word_option_name"
|
||||||
|
android:visibility="gone" />
|
||||||
|
<EditText android:id="@+id/user_dictionary_add_word_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="fill_horizontal|center_vertical"
|
||||||
|
android:layout_marginLeft="8dip"
|
||||||
|
android:layout_marginBottom="8dip"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:imeOptions="flagNoFullscreen">
|
||||||
<requestFocus />
|
<requestFocus />
|
||||||
</EditText>
|
</EditText>
|
||||||
|
<TextView android:id="@+id/user_dictionary_add_shortcut_label"
|
||||||
<LinearLayout android:id="@+id/user_dict_settings_add_dialog_shortcut_interface"
|
style="?android:attr/textAppearanceSmall"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_gravity="left|center_vertical"
|
||||||
android:visibility="gone" >
|
android:text="@string/user_dict_settings_add_shortcut_option_name"
|
||||||
<!-- Shortcut interface. Reactivate when shortcut are supported by the subsystem.
|
android:visibility="gone" />
|
||||||
<TextView style="?android:attr/textAppearanceSmall"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="8dip"
|
|
||||||
android:text="@string/user_dict_settings_add_shortcut_option_name" />
|
|
||||||
<EditText android:id="@+id/user_dictionary_settings_add_dialog_shortcut"
|
<EditText android:id="@+id/user_dictionary_settings_add_dialog_shortcut"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="fill_horizontal|center_vertical"
|
||||||
android:layout_marginLeft="8dip"
|
android:layout_marginLeft="8dip"
|
||||||
android:layout_marginRight="8dip"
|
android:layout_marginBottom="8dip"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
android:imeOptions="flagNoFullscreen" />
|
android:imeOptions="flagNoFullscreen"
|
||||||
-->
|
android:visibility="gone" />
|
||||||
<TextView android:layout_width="match_parent"
|
<TextView android:id="@+id/user_dictionary_add_locale_label"
|
||||||
|
style="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dip"
|
android:layout_gravity="left|center_vertical"
|
||||||
android:text="@string/user_dict_settings_add_locale_option_name" />
|
android:text="@string/user_dict_settings_add_locale_option_name"
|
||||||
|
android:visibility="gone" />
|
||||||
<Spinner android:id="@+id/user_dictionary_settings_add_dialog_locale"
|
<Spinner android:id="@+id/user_dictionary_settings_add_dialog_locale"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginLeft="8dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginBottom="8dip"
|
||||||
android:layout_margin="8dip" />
|
android:layout_marginTop="8dip"
|
||||||
</LinearLayout>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="fill_horizontal|center_vertical"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</GridLayout>
|
||||||
|
|
||||||
<LinearLayout android:layout_width="match_parent"
|
<LinearLayout android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -2609,9 +2609,11 @@
|
|||||||
<string name="user_dict_settings_add_dialog_less_options">Less options</string>
|
<string name="user_dict_settings_add_dialog_less_options">Less options</string>
|
||||||
<!-- User dictionary settings. Text on the dialog button to confirm adding a word. [CHAR LIMIT=15] -->
|
<!-- User dictionary settings. Text on the dialog button to confirm adding a word. [CHAR LIMIT=15] -->
|
||||||
<string name="user_dict_settings_add_dialog_confirm">OK</string>
|
<string name="user_dict_settings_add_dialog_confirm">OK</string>
|
||||||
<!-- User dictionary settings. Label to put before the shortcut field (once a shortcut is registered, the user can type the shortcut and get the word it points to in the suggestions). [CHAR LIMIT=25] -->
|
<!-- User dictionary settings. Label to put before the word field (that's the word that will actually be added to the user dictionary when OK is pressed). [CHAR LIMIT=20] -->
|
||||||
|
<string name="user_dict_settings_add_word_option_name">Word:</string>
|
||||||
|
<!-- User dictionary settings. Label to put before the shortcut field (once a shortcut is registered, the user can type the shortcut and get the word it points to in the suggestions). [CHAR LIMIT=20] -->
|
||||||
<string name="user_dict_settings_add_shortcut_option_name">Shortcut:</string>
|
<string name="user_dict_settings_add_shortcut_option_name">Shortcut:</string>
|
||||||
<!-- User dictionary settings. Label to put before the language field. [CHAR LIMIT=25] -->
|
<!-- User dictionary settings. Label to put before the language field. [CHAR LIMIT=20] -->
|
||||||
<string name="user_dict_settings_add_locale_option_name">Language:</string>
|
<string name="user_dict_settings_add_locale_option_name">Language:</string>
|
||||||
<!-- User dictionary settings. The title of the dialog to edit an existing word in the user dictionary. -->
|
<!-- User dictionary settings. The title of the dialog to edit an existing word in the user dictionary. -->
|
||||||
<string name="user_dict_settings_edit_dialog_title">Edit word</string>
|
<string name="user_dict_settings_edit_dialog_title">Edit word</string>
|
||||||
|
@@ -32,7 +32,6 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.UserDictionary;
|
import android.provider.UserDictionary;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -55,6 +54,14 @@ public class UserDictionaryAddWordActivity extends Activity
|
|||||||
private static final int MODE_EDIT = 0;
|
private static final int MODE_EDIT = 0;
|
||||||
private static final int MODE_INSERT = 1;
|
private static final int MODE_INSERT = 1;
|
||||||
|
|
||||||
|
private static final int[] IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE = {
|
||||||
|
R.id.user_dictionary_add_word_label,
|
||||||
|
R.id.user_dictionary_add_shortcut_label,
|
||||||
|
R.id.user_dictionary_add_locale_label,
|
||||||
|
R.id.user_dictionary_settings_add_dialog_shortcut,
|
||||||
|
R.id.user_dictionary_settings_add_dialog_locale,
|
||||||
|
};
|
||||||
|
|
||||||
private EditText mEditText;
|
private EditText mEditText;
|
||||||
private int mMode; // Either MODE_EDIT or MODE_INSERT
|
private int mMode; // Either MODE_EDIT or MODE_INSERT
|
||||||
private String mOldWord;
|
private String mOldWord;
|
||||||
@@ -106,7 +113,10 @@ public class UserDictionaryAddWordActivity extends Activity
|
|||||||
onClickMoreOptions(findViewById(R.id.user_dictionary_settings_add_dialog_more_options));
|
onClickMoreOptions(findViewById(R.id.user_dictionary_settings_add_dialog_more_options));
|
||||||
}
|
}
|
||||||
|
|
||||||
final ViewGroup v = (ViewGroup)findViewById(R.id.user_dict_settings_add_dialog_top);
|
// TODO: The following code enables layout transition for eye-candy, but there is still
|
||||||
|
// a jankiness issue with the window moving on one frame, resizing suddenly on the next,
|
||||||
|
// and animation only starting afterwards on children.
|
||||||
|
final ViewGroup v = (ViewGroup)findViewById(R.id.user_dictionary_add_word_grid);
|
||||||
final LayoutTransition transition = new LayoutTransition();
|
final LayoutTransition transition = new LayoutTransition();
|
||||||
transition.setStartDelay(LayoutTransition.APPEARING, 0);
|
transition.setStartDelay(LayoutTransition.APPEARING, 0);
|
||||||
v.setLayoutTransition(transition);
|
v.setLayoutTransition(transition);
|
||||||
@@ -168,6 +178,7 @@ public class UserDictionaryAddWordActivity extends Activity
|
|||||||
mDescription = Utils.createLocaleFromString(localeString).getDisplayName();
|
mDescription = Utils.createLocaleFromString(localeString).getDisplayName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mDescription;
|
return mDescription;
|
||||||
}
|
}
|
||||||
@@ -184,9 +195,10 @@ public class UserDictionaryAddWordActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClickMoreOptions(final View v) {
|
public void onClickMoreOptions(final View v) {
|
||||||
final View moreOptionsView =
|
for (final int idToShow : IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE) {
|
||||||
findViewById(R.id.user_dict_settings_add_dialog_shortcut_interface);
|
final View viewToShow = findViewById(idToShow);
|
||||||
moreOptionsView.setVisibility(View.VISIBLE);
|
viewToShow.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
|
findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
|
||||||
.setVisibility(View.GONE);
|
.setVisibility(View.GONE);
|
||||||
findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
|
findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
|
||||||
@@ -223,9 +235,10 @@ public class UserDictionaryAddWordActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClickLessOptions(final View v) {
|
public void onClickLessOptions(final View v) {
|
||||||
final View moreOptionsView =
|
for (final int idToHide : IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE) {
|
||||||
findViewById(R.id.user_dict_settings_add_dialog_shortcut_interface);
|
final View viewToHide = findViewById(idToHide);
|
||||||
moreOptionsView.setVisibility(View.GONE);
|
viewToHide.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
|
findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
|
||||||
.setVisibility(View.VISIBLE);
|
.setVisibility(View.VISIBLE);
|
||||||
findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
|
findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
|
||||||
|
Reference in New Issue
Block a user