Settings: Correctly align cursor in Settings
Steps to Reproduce: - Click on Density Settings (DPI Settings) / Renaming BT Device / Renaming SIM Settings - EditText Dialog pops up - The cursor is at the leftmost side of the text - Logically Cursor should be at rightmost side which can be aligned grabbing text length Screenshots: Before: http://imgur.com/a/o4vkr http://imgur.com/a/6Qext After: http://imgur.com/a/fuxqT http://imgur.com/a/vm2WX Bug: 65185652 Test: RunSettingsRoboTests: OK (47 tests) Change-Id: Id00308e7e019434edad4afab56cf4719be0d0d54 Signed-off-by: PMS22 <prathams99@rediff.com>
This commit is contained in:
@@ -25,6 +25,8 @@ import android.os.storage.VolumeInfo;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.style.TtsSpan;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.wrapper.DevicePolicyManagerWrapper;
|
||||
@@ -325,4 +327,15 @@ public class UtilsTest {
|
||||
assertThat(Utils.isProfileOrDeviceOwner(mUserManager, mDevicePolicyManager,
|
||||
PACKAGE_NAME)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetEditTextCursorPosition_shouldGetExpectedEditTextLenght() {
|
||||
final EditText editText = new EditText(mContext);
|
||||
final CharSequence text = "test";
|
||||
editText.setText(text, TextView.BufferType.EDITABLE);
|
||||
final int length = editText.getText().length();
|
||||
Utils.setEditTextCursorPosition(editText);
|
||||
|
||||
assertThat(editText.getSelectionEnd()).isEqualTo(length);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user