Add the more options interface.
The interface is not functional yet, aside from the "Manage" button. This will come in a later change. Step 5 Bug: 5306641 Change-Id: I4bdea099eece7ba8a50bbfb47e173036334064ea
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/user_dict_settings_add_dialog_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
@@ -36,7 +37,6 @@
|
||||
android:background="@android:color/holo_blue_light" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<EditText android:id="@+id/user_dictionary_add_word_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -49,6 +49,32 @@
|
||||
<requestFocus/>
|
||||
</EditText>
|
||||
|
||||
<LinearLayout android:id="@+id/user_dict_settings_add_dialog_shortcut_interface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:layout_marginRight="8dip"
|
||||
android:inputType="textNoSuggestions" />
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:text="@string/user_dict_settings_add_locale_option_name" />
|
||||
<Spinner android:id="@+id/user_dictionary_settings_add_dialog_locale"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dip" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@@ -69,14 +95,27 @@
|
||||
android:text="@string/cancel"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickCancel" />
|
||||
<Button android:layout_width="0dip"
|
||||
<Button android:id="@+id/user_dictionary_settings_add_dialog_options"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/user_dict_settings_add_dialog_options"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickOptions" />
|
||||
<Button android:id="@+id/user_dictionary_settings_add_dialog_manage"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/user_dict_settings_add_dialog_manage"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:onClick="onClickManage" />
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_gravity="right"
|
||||
android:layout_weight="1"
|
||||
|
@@ -2600,12 +2600,18 @@ found in the list of installed apps.</string>
|
||||
<string name="user_dict_settings_summary">""</string>
|
||||
<!-- User dictionary settings. The title of the menu item to add a new word to the user dictionary. -->
|
||||
<string name="user_dict_settings_add_menu_title">Add</string>
|
||||
<!-- User dictionary settings. The title of the dialog to add a new word to the user dictionary. -->
|
||||
<!-- User dictionary settings. The title of the dialog to add a new word to the user dictionary. [CHAR LIMIT=25] -->
|
||||
<string name="user_dict_settings_add_dialog_title">Add to dictionary</string>
|
||||
<!-- User dictionary settings. Text on the dialog button to pop more options for adding a word. -->
|
||||
<string name="user_dict_settings_add_dialog_options">Options…</string>
|
||||
<!-- User dictionary settings. Text on the dialog button to confirm adding a word. -->
|
||||
<!-- User dictionary settings. Text on the dialog button to pop more options for adding a word. [CHAR LIMIT=15] -->
|
||||
<string name="user_dict_settings_add_dialog_options">Options</string>
|
||||
<!-- User dictionary settings. Text on the dialog button to show the full user dictionary interface. [CHAR LIMIT=15] -->
|
||||
<string name="user_dict_settings_add_dialog_manage">Manage entries</string>
|
||||
<!-- 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>
|
||||
<!-- User dictionary settings. Label to put before the shortcut field. [CHAR LIMIT=25] -->
|
||||
<string name="user_dict_settings_add_shortcut_option_name">Shortcut:</string>
|
||||
<!-- User dictionary settings. Label to put before the language field. [CHAR LIMIT=25] -->
|
||||
<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. -->
|
||||
<string name="user_dict_settings_edit_dialog_title">Edit word</string>
|
||||
<!-- User dictionary settings. The title of the context menu item to edit the current word -->
|
||||
|
@@ -22,12 +22,14 @@ import com.android.settings.Utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import android.animation.LayoutTransition;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.UserDictionary;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class UserDictionaryAddWordActivity extends Activity {
|
||||
@@ -66,12 +68,30 @@ public class UserDictionaryAddWordActivity extends Activity {
|
||||
mEditText.setText(mOldWord);
|
||||
mEditText.setSelection(mOldWord.length());
|
||||
}
|
||||
final ViewGroup v = (ViewGroup)findViewById(R.id.user_dict_settings_add_dialog_top);
|
||||
final LayoutTransition transition = new LayoutTransition();
|
||||
transition.setStartDelay(LayoutTransition.APPEARING, 0);
|
||||
v.setLayoutTransition(transition);
|
||||
}
|
||||
|
||||
public void onClickCancel(final View v) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void onClickOptions(final View v) {
|
||||
final View moreOptionsView =
|
||||
findViewById(R.id.user_dict_settings_add_dialog_shortcut_interface);
|
||||
moreOptionsView.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.user_dictionary_settings_add_dialog_options).setVisibility(View.GONE);
|
||||
findViewById(R.id.user_dictionary_settings_add_dialog_manage).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void onClickManage(final View v) {
|
||||
final Intent intent = new Intent(v.getContext(), UserDictionarySettings.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void onClickConfirm(final View v) {
|
||||
if (MODE_EDIT == mMode && !TextUtils.isEmpty(mOldWord)) {
|
||||
UserDictionarySettings.deleteWord(mOldWord, this.getContentResolver());
|
||||
|
Reference in New Issue
Block a user