Merge "Update language to comply with Android’s inclusive language guidance" am: 5f7d33da75

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1378632

Change-Id: I01d5caddd880524366df2d6d196908f902534e58
This commit is contained in:
Treehugger Robot
2020-09-23 10:39:39 +00:00
committed by Automerger Merge Worker
3 changed files with 8 additions and 144 deletions

View File

@@ -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" />

View File

@@ -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;
}
}
}

View File

@@ -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));