diff options
| author | 2020-07-29 15:39:16 -0700 | |
|---|---|---|
| committer | 2020-09-22 02:22:28 +0000 | |
| commit | a80b45969aca8cdef0dd603a19e2016cb39a9fc8 (patch) | |
| tree | ed1eaf22dff49a28ca9cc87267513b9b742855a1 | |
| parent | 633415235771dea4d2236ecfe900019f59b82d9a (diff) | |
Update language to comply with Android’s inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference
ListOfEditTexts is not referred anywhere, so good to remove it rather than
fixing words.
Bug: 161896447
Test: atest CharSequencesTest
Change-Id: I9dc07fa5f087e355d01fbc939749fac2f1f1f554
Merged-In: I9dc07fa5f087e355d01fbc939749fac2f1f1f554
3 files changed, 8 insertions, 144 deletions
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index 5c2841aff1d8..b39c89b62eb1 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -212,13 +212,6 @@ </intent-filter> </activity> - <activity android:name="android.widget.focus.ListOfButtons" android:label="ListOfButtons"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" /> - </intent-filter> - </activity> - <activity android:name="android.widget.focus.LinearLayoutGrid" android:label="LinearLayoutGrid"> <intent-filter> <action android:name="android.intent.action.MAIN" /> diff --git a/core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java b/core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java deleted file mode 100644 index 936c9999e7f8..000000000000 --- a/core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -package android.widget.focus; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.ListView; - -import com.google.android.collect.Lists; - -import java.util.List; - -public class ListOfEditTexts extends Activity { - - private int mLinesPerEditText = 12; - - private ListView mListView; - private LinearLayout mLinearLayout; - - public ListView getListView() { - return mListView; - } - - @Override - protected void onCreate(Bundle icicle) { - super.onCreate(icicle); - - // create linear layout - mLinearLayout = new LinearLayout(this); - mLinearLayout.setOrientation(LinearLayout.VERTICAL); - mLinearLayout.setLayoutParams(new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT)); - - // add a button above - Button buttonAbove = new Button(this); - buttonAbove.setLayoutParams( - new LinearLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT)); - buttonAbove.setText("button above list"); - mLinearLayout.addView(buttonAbove); - - // add a list view to it - mListView = new ListView(this); - mListView.setLayoutParams(new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT)); - mListView.setDrawSelectorOnTop(false); - mListView.setItemsCanFocus(true); - mListView.setLayoutParams((new LinearLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - 0, - 1f))); - - List<String> bodies = Lists.newArrayList( - getBody("zero hello, my name is android"), - getBody("one i'm a paranoid android"), - getBody("two i robot. huh huh."), - getBody("three not the g-phone!")); - - mListView.setAdapter(new MyAdapter(this, bodies)); - mLinearLayout.addView(mListView); - - // add button below - Button buttonBelow = new Button(this); - buttonBelow.setLayoutParams( - new LinearLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT)); - buttonBelow.setText("button below list"); - mLinearLayout.addView(buttonBelow); - - setContentView(mLinearLayout); - } - - String getBody(String line) { - StringBuilder sb = new StringBuilder((line.length() + 5) * mLinesPerEditText); - for (int i = 0; i < mLinesPerEditText; i++) { - sb.append(i + 1).append(' ').append(line); - if (i < mLinesPerEditText - 1) { - sb.append('\n'); // all but last line - } - } - return sb.toString(); - } - - - private static class MyAdapter extends ArrayAdapter<String> { - - public MyAdapter(Context context, List<String> bodies) { - super(context, 0, bodies); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - String body = getItem(position); - - if (convertView != null) { - ((EditText) convertView).setText(body); - return convertView; - } - - EditText editText = new EditText(getContext()); - editText.setText(body); - return editText; - } - } -} diff --git a/core/tests/utiltests/src/com/android/internal/util/CharSequencesTest.java b/core/tests/utiltests/src/com/android/internal/util/CharSequencesTest.java index 55d186c292f6..469a4ccd05e4 100644 --- a/core/tests/utiltests/src/com/android/internal/util/CharSequencesTest.java +++ b/core/tests/utiltests/src/com/android/internal/util/CharSequencesTest.java @@ -16,16 +16,17 @@ package com.android.internal.util; -import com.android.internal.util.CharSequences; import static com.android.internal.util.CharSequences.forAsciiBytes; -import junit.framework.TestCase; + import android.test.suitebuilder.annotation.SmallTest; +import junit.framework.TestCase; + public class CharSequencesTest extends TestCase { @SmallTest public void testCharSequences() { - String s = "Crazy Bob"; + String s = "Hello Bob"; byte[] bytes = s.getBytes(); String copy = toString(forAsciiBytes(bytes)); @@ -34,11 +35,11 @@ public class CharSequencesTest extends TestCase { copy = toString(forAsciiBytes(bytes, 0, s.length())); assertTrue(s.equals(copy)); - String crazy = toString(forAsciiBytes(bytes, 0, 5)); - assertTrue("Crazy".equals(crazy)); + String hello = toString(forAsciiBytes(bytes, 0, 5)); + assertTrue("Hello".equals(hello)); - String a = toString(forAsciiBytes(bytes, 0, 3).subSequence(2, 3)); - assertTrue("a".equals(a)); + String l = toString(forAsciiBytes(bytes, 0, 3).subSequence(2, 3)); + assertTrue("l".equals(l)); String empty = toString(forAsciiBytes(bytes, 0, 3).subSequence(3, 3)); assertTrue("".equals(empty)); |