M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := ImfTest
include $(BUILD_PACKAGE)
# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
+146
View File
@@ -0,0 +1,146 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.imftest">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<application>
<activity android:name=".samples.InputTypeActivity" android:label="Input Type Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.ButtonActivity" android:label="Button Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BigEditTextActivityNonScrollablePanScan" android:label="Big ET !Scroll Pan/Scan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.ManyEditTextActivityNoScrollPanScan" android:label="ManyEditTextActivityNoScrollPanScan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BigEditTextActivityNonScrollableResize" android:label="Big ET !Scroll Resize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BigEditTextActivityScrollablePanScan" android:label="Big ET Scroll Pan/Scan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BigEditTextActivityScrollableResize" android:label="Big ET Scroll Resize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.EditTextActivityDialog" android:label="ET Dialog">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.ManyEditTextActivityScrollPanScan" android:label="ManyEditTextActivityScrollPanScan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.ManyEditTextActivityScrollResize" android:label="ManyEditTextActivityScrollResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BottomEditTextActivityPanScan" android:label="BottomEditTextActivityPanScan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.BottomEditTextActivityResize" android:label="BottomEditTextActivityResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.OneEditTextActivitySelected" android:label="OneEditTextActivitySelected">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.OneEditTextActivityNotSelected" android:label="OneEditTextActivityNotSelected">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.AutoCompleteTextViewActivityPortrait" android:label="AutoCompleteTextViewActivityPortrait" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.AutoCompleteTextViewActivityLandscape" android:label="AutoCompleteTextViewActivityLandscape" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
<activity android:name=".samples.DialogActivity" android:label="DialogActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.IMF_TEST" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dip"
android:orientation="vertical">
<View
android:id="@+id/blank"
android:layout_height="0dip"
android:layout_width="match_parent"
android:layout_weight="1"/>
<EditText
android:id="@+id/dialog_edit_text"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/samples/SampleCode/res/layout/baseline_1.xml
**
** Copyright 2009, 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.
*/
-->
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minLines="15"
android:gravity="top"/>
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/samples/SampleCode/res/layout/baseline_1.xml
**
** Copyright 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.
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:baselineAligned="false">
<View android:id="@+id/blank"
android:layout_height="0dip"
android:layout_width="match_parent"
android:layout_weight="1"
/>
<EditText android:id="@+id/dialog_edit_text"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:drawable/divider_horizontal_dark"
/>
</LinearLayout>
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/samples/SampleCode/res/layout/baseline_1.xml
**
** Copyright 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.
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:baselineAligned="false"
android:gravity="center_vertical"
>
<TextView android:id="@+id/label"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:gravity="right|center_vertical"
/>
<EditText android:id="@+id/data"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:drawable/divider_horizontal_dark"
/>
</LinearLayout>
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2009, 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.
*/
-->
<resources>
<bool name="def_expect_ime_autopop">false</bool>
</resources>
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, 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.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Strings for sample activities -->
<string name="normal_edit_text_label">Normal</string>
<string name="uri_edit_text_label">Uri</string>
<string name="email_address_edit_text_label">Email Address</string>
<string name="email_subject_edit_text_label">Email Subject</string>
<string name="email_content_edit_text_label">Email Content</string>
<string name="person_name_edit_text_label">Person Name</string>
<string name="postal_address_edit_text_label">Postal Address</string>
<string name="password_edit_text_label">Password</string>
<string name="search_string_edit_text_label">Search String</string>
<string name="web_edit_text_label">Web Edit Text</string>
<string name="signed_number_edit_text_label">Signed Number</string>
<string name="decimal_number_edit_text_label">Decimal Number</string>
<string name="phone_number_edit_text_label">Phone Number</string>
<string name="normal_datetime_edit_text_label">Datetime</string>
<string name="date_edit_text_label">Date</string>
<string name="time_edit_text_label">Time</string>
<string name="cap_chars_edit_text_label">Cap Chars</string>
<string name="cap_words_edit_text_label">Cap Words</string>
<string name="multiline_edit_text_label">Multiline</string>
<string name="search_edit_text_label">Search (flag)</string>
<string name="cap_sentences_edit_text_label">Cap Sentences</string>
<string name="auto_complete_edit_text_label">Auto Complete</string>
<string name="auto_correct_edit_text_label">Auto Correct</string>
<string name="test_dialog">Test Dialog</string>
<string name="open_dialog_scrollable">open scrollable dialog</string>
<string name="open_dialog_nonscrollable">open nonscrollable dialog</string>
</resources>
@@ -0,0 +1,101 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.app.ActivityManagerNative;
import android.os.Bundle;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.AutoCompleteTextView;
import android.widget.ArrayAdapter;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import com.android.internal.R;
/*
* Activity with AutoCompleteTextView forced to landscape mode
*/
public class AutoCompleteTextViewActivityLandscape extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.auto_complete_list);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
textView.setAdapter(adapter);
}
static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
"Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
"Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
"British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
"Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
"Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
"Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
"Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
"East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
"Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
"Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
"French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
"Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
"Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
"Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
"Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
"Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
"Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
"Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
"Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
"Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
"Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
"Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
"Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
"Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
"Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
"Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
"Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
"Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
"Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
"The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
"Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom",
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
"Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
"Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
};
}
@@ -0,0 +1,95 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.AutoCompleteTextView;
import android.widget.ArrayAdapter;
import com.android.internal.R;
/*
* Activity with AutoCompleteTextView (Candidate bar should not appear)
*/
public class AutoCompleteTextViewActivityPortrait extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.auto_complete_list);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
textView.setAdapter(adapter);
}
static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
"Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
"Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
"British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
"Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
"Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
"Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
"Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
"East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
"Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
"Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
"French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
"Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
"Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
"Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
"Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
"Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
"Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
"Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
"Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
"Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
"Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
"Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
"Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
"Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
"Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
"Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
"Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
"Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
"Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
"The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
"Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom",
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
"Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
"Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
};
}
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
public class BigEditTextActivityNonScrollablePanScan extends Activity {
private View mRootView;
private View mDefaultFocusedView;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
mRootView = new LinearLayout(this);
((LinearLayout) mRootView).setOrientation(LinearLayout.VERTICAL);
mRootView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
View view = getLayoutInflater().inflate(
R.layout.full_screen_edit_text, ((LinearLayout) mRootView), false);
((LinearLayout) mRootView).addView(view);
mDefaultFocusedView = view.findViewById(R.id.data);
setContentView(mRootView);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
public class BigEditTextActivityNonScrollableResize extends Activity {
private View mRootView;
private View mDefaultFocusedView;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mRootView = new LinearLayout(this);
((LinearLayout) mRootView).setOrientation(LinearLayout.VERTICAL);
mRootView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
View view = getLayoutInflater().inflate(
R.layout.full_screen_edit_text, ((LinearLayout) mRootView), false);
((LinearLayout) mRootView).addView(view);
mDefaultFocusedView = view.findViewById(R.id.data);
setContentView(mRootView);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.ScrollView;
public class BigEditTextActivityScrollablePanScan extends Activity {
private View mRootView;
private View mDefaultFocusedView;
private LinearLayout mLayout;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
mRootView = new ScrollView(this);
((ScrollView) mRootView).setFillViewport(true);
mRootView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
View view = getLayoutInflater().inflate(
R.layout.full_screen_edit_text, ((ScrollView) mRootView), false);
mLayout.addView(view);
((ScrollView) mRootView).addView(mLayout);
mDefaultFocusedView = view.findViewById(R.id.data);
setContentView(mRootView);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.ScrollView;
public class BigEditTextActivityScrollableResize extends Activity {
private View mRootView;
private View mDefaultFocusedView;
private LinearLayout mLayout;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mRootView = new ScrollView(this);
((ScrollView) mRootView).setFillViewport(true);
mRootView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
View view = getLayoutInflater().inflate(
R.layout.full_screen_edit_text, ((ScrollView) mRootView), false);
mLayout.addView(view);
((ScrollView) mRootView).addView(mLayout);
mDefaultFocusedView = view.findViewById(R.id.data);
setContentView(mRootView);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import com.android.imftest.R;
/*
* Activity with EditText at the bottom (Pan&Scan)
*/
public class BottomEditTextActivityPanScan extends Activity
{
private View mRootView;
private View mDefaultFocusedView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mRootView = new LinearLayout(this);
((LinearLayout) mRootView).setOrientation(LinearLayout.VERTICAL);
View view = getLayoutInflater().inflate(R.layout.one_edit_text_activity, ((LinearLayout) mRootView), false);
mDefaultFocusedView = view.findViewById(R.id.dialog_edit_text);
((LinearLayout) mRootView).addView(view);
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import com.android.imftest.R;
/*
* Activity with EditText at the bottom (Resize)
*/
public class BottomEditTextActivityResize extends Activity
{
private View mRootView;
private View mDefaultFocusedView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mRootView = new LinearLayout(this);
((LinearLayout) mRootView).setOrientation(LinearLayout.VERTICAL);
View view = getLayoutInflater().inflate(R.layout.one_edit_text_activity, ((LinearLayout) mRootView), false);
mDefaultFocusedView = view.findViewById(R.id.dialog_edit_text);
((LinearLayout) mRootView).addView(view);
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
public class ButtonActivity extends Activity
{
static boolean mKeyboardIsActive = false;
public static final int BUTTON_ID = 0;
private View mRootView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
final ButtonActivity instance = this;
final Button myButton = new Button(this);
myButton.setClickable(true);
myButton.setText("Keyboard UP!");
myButton.setId(BUTTON_ID);
myButton.setFocusableInTouchMode(true);
myButton.setOnClickListener(new View.OnClickListener()
{
public void onClick (View v)
{
InputMethodManager imm = InputMethodManager.getInstance(instance);
if (mKeyboardIsActive)
{
imm.hideSoftInputFromInputMethod(v.getWindowToken(), 0);
myButton.setText("Keyboard UP!");
}
else
{
myButton.requestFocusFromTouch();
imm.showSoftInput(v, 0);
myButton.setText("Keyboard DOWN!");
}
mKeyboardIsActive = !mKeyboardIsActive;
}
});
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(myButton);
setContentView(layout);
mRootView = layout;
}
public View getRootView() {
return mRootView;
}
}
@@ -0,0 +1,114 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.EditText;
import android.widget.Button;
import android.view.LayoutInflater;
import android.app.Dialog;
public class DialogActivity extends Activity {
private static final int DIALOG_WITHOUT_EDITTEXT = 0;
private static final int DIALOG_WITH_EDITTEXT = 1;
private LinearLayout mLayout;
private LayoutInflater mInflater;
private Button mButton1;
private Button mButton2;
private EditText mEditText;
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mButton1 = new Button(this);
mButton1.setText("Dialog WITHOUT EditText");//(R.string.open_dialog_scrollable);
mButton1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
showDialog(DIALOG_WITHOUT_EDITTEXT);
}
});
mButton2 = new Button(this);
mButton2.setText("Dialog WITH EditText");//(R.string.open_dialog_nonscrollable);
mButton2.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
showDialog(DIALOG_WITH_EDITTEXT);
}
});
mEditText = new EditText(this);
mLayout.addView(mEditText);
mLayout.addView(mButton1);
mLayout.addView(mButton2);
setContentView(mLayout);
}
@Override
protected Dialog onCreateDialog(int id)
{
switch (id)
{
case DIALOG_WITHOUT_EDITTEXT:
return createDialog(false);
case DIALOG_WITH_EDITTEXT:
return createDialog(true);
}
return super.onCreateDialog(id);
}
protected Dialog createDialog(boolean bEditText)
{
LinearLayout layout;
layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
if(bEditText)
{
EditText editText;
editText = new EditText(this);
layout.addView(editText);
}
Dialog d = new Dialog(this);
d.setTitle("The DIALOG!!!");
d.setCancelable(true);
d.setContentView(layout);
return d;
}
}
@@ -0,0 +1,111 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
public class EditTextActivityDialog extends Activity {
private static final int SCROLLABLE_DIALOG_ID = 0;
private static final int NONSCROLLABLE_DIALOG_ID = 1;
private LinearLayout mLayout;
private ScrollView mScrollView;
private LayoutInflater mInflater;
private Button mButton1;
private Button mButton2;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mButton1 = new Button(this);
mButton1.setText(R.string.open_dialog_scrollable);
mButton1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(SCROLLABLE_DIALOG_ID);
}
});
mButton2 = new Button(this);
mButton2.setText(R.string.open_dialog_nonscrollable);
mButton2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(NONSCROLLABLE_DIALOG_ID);
}
});
mLayout.addView(mButton1);
mLayout.addView(mButton2);
setContentView(mLayout);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case SCROLLABLE_DIALOG_ID:
return createDialog(true);
case NONSCROLLABLE_DIALOG_ID:
return createDialog(false);
}
return super.onCreateDialog(id);
}
protected Dialog createDialog(boolean scrollable) {
View layout;
EditText editText;
if (scrollable) {
layout = new ScrollView(EditTextActivityDialog.this);
((ScrollView) layout).setMinimumHeight(mLayout.getHeight());
((ScrollView) layout).addView((
LinearLayout) View.inflate(EditTextActivityDialog.this,
R.layout.dialog_edit_text_no_scroll, null));
} else {
layout = View.inflate(EditTextActivityDialog.this,
R.layout.dialog_edit_text_no_scroll, null);
}
Dialog d = new Dialog(EditTextActivityDialog.this);
d.setTitle(getString(R.string.test_dialog));
d.setCancelable(true);
d.setContentView(layout);
return d;
}
}
@@ -0,0 +1,156 @@
/*
* 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.app.Activity;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
public class InputTypeActivity extends Activity {
private LinearLayout mLayout;
private ScrollView mScrollView;
private LayoutInflater mInflater;
private ViewGroup mParent;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mScrollView = new ScrollView(this);
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mInflater = getLayoutInflater();
mParent = mLayout;
/* Normal Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL,
R.string.normal_edit_text_label));
/* Normal Edit Text w/Cap Chars Flag*/
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS,
R.string.cap_chars_edit_text_label));
/* Normal Edit Text w/Cap Words Flag*/
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS,
R.string.cap_words_edit_text_label));
/* Normal Edit Text w/Cap Multiline Flag */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE,
R.string.multiline_edit_text_label));
/* Normal Edit Text w/Cap Sentences Flag */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES,
R.string.cap_sentences_edit_text_label));
/* Normal Edit Text w/Auto-complete Flag */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE,
R.string.auto_complete_edit_text_label));
/* Normal Edit Text w/Auto-correct Flag */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_NORMAL|EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT,
R.string.auto_correct_edit_text_label));
/* Uri Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_URI,
R.string.uri_edit_text_label));
/* Email Address Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS,
R.string.email_address_edit_text_label));
/* Email Subject Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_EMAIL_SUBJECT,
R.string.email_subject_edit_text_label));
/* Email Content Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_LONG_MESSAGE,
R.string.email_content_edit_text_label));
/* Person Name Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME,
R.string.person_name_edit_text_label));
/* Postal Address Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_POSTAL_ADDRESS,
R.string.postal_address_edit_text_label));
/* Password Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_PASSWORD,
R.string.password_edit_text_label));
/* Web Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT|EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT,
R.string.web_edit_text_label));
/* Signed Number Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_NUMBER|EditorInfo.TYPE_NUMBER_FLAG_SIGNED,
R.string.signed_number_edit_text_label));
/* Decimal Number Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_NUMBER|EditorInfo.TYPE_NUMBER_FLAG_DECIMAL,
R.string.decimal_number_edit_text_label));
/* Phone Number Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_PHONE,
R.string.phone_number_edit_text_label));
/* Normal Datetime Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME|EditorInfo.TYPE_DATETIME_VARIATION_NORMAL,
R.string.normal_datetime_edit_text_label));
/* Date Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME|EditorInfo.TYPE_DATETIME_VARIATION_DATE,
R.string.date_edit_text_label));
/* Time Edit Text */
mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME|EditorInfo.TYPE_DATETIME_VARIATION_TIME,
R.string.time_edit_text_label));
mScrollView.addView(mLayout);
setContentView(mScrollView);
}
private View buildEntryView(int inputType, int label) {
View view = mInflater.inflate(R.layout.sample_edit_text, mParent, false);
EditText editText = (EditText) view.findViewById(R.id.data);
editText.setInputType(inputType);
TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText(label);
return view;
}
}
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ScrollView;
import com.android.internal.R;
/*
* Full screen of EditTexts (Non-Scrollable, Pan&Scan)
*/
public class ManyEditTextActivityNoScrollPanScan extends Activity
{
public static final int NUM_EDIT_TEXTS = 9;
private View mRootView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mRootView = new LinearLayout(this);
((LinearLayout) mRootView).setOrientation(LinearLayout.VERTICAL);
for (int i=0; i<NUM_EDIT_TEXTS; i++)
{
final EditText editText = new EditText(this);
editText.setText(String.valueOf(i));
editText.setId(i);
((LinearLayout) mRootView).addView(editText);
}
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
public View getRootView() {
return mRootView;
}
}
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ScrollView;
import com.android.internal.R;
/*
* Full screen of EditTexts (Scrollable, Pan&Scan)
*/
public class ManyEditTextActivityScrollPanScan extends Activity
{
public static final int NUM_EDIT_TEXTS = 12;
private View mRootView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mRootView = new ScrollView(this);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
for (int i=0; i<NUM_EDIT_TEXTS; i++)
{
final EditText editText = new EditText(this);
editText.setText(String.valueOf(i));
editText.setId(i);
layout.addView(editText);
}
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
public View getRootView() {
return mRootView;
}
}
@@ -0,0 +1,61 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.EditText;
import android.widget.ScrollView;
/*
* Full screen of EditTexts (Scrollable, Resize)
*/
public class ManyEditTextActivityScrollResize extends Activity
{
public static final int NUM_EDIT_TEXTS = 12;
private View mRootView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mRootView = new ScrollView(this);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
for (int i=0; i<NUM_EDIT_TEXTS; i++)
{
final EditText editText = new EditText(this);
editText.setText(String.valueOf(i));
editText.setId(i);
layout.addView(editText);
}
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
public View getRootView() {
return mRootView;
}
}
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.os.Debug;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ScrollView;
import com.android.internal.R;
/*
* Activity with non-EditText view selected initially
*/
public class OneEditTextActivityNotSelected extends Activity
{
private View mRootView;
private View mDefaultFocusedView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
mRootView = new ScrollView(this);
EditText editText = new EditText(this);
Button button = new Button(this);
button.setText("The focus is here.");
button.setFocusableInTouchMode(true);
button.requestFocus();
mDefaultFocusedView = button;
layout.addView(button);
layout.addView(editText);
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2009 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 com.android.imftest.samples;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ScrollView;
import com.android.internal.R;
/*
* Activity with EditText selected initially
*/
public class OneEditTextActivitySelected extends Activity
{
private View mRootView;
private View mDefaultFocusedView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
mRootView = new ScrollView(this);
EditText editText = new EditText(this);
editText.requestFocus();
mDefaultFocusedView = editText;
layout.addView(editText);
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
// set to resize so IME is always shown (and also so
// ImfBaseTestCase#destructiveCheckImeInitialState thinks it should always be shown
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
public View getRootView() {
return mRootView;
}
public View getDefaultFocusedView() {
return mDefaultFocusedView;
}
}
+16
View File
@@ -0,0 +1,16 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
# Include all test java files.
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_PACKAGE_NAME := ImfTestTests
LOCAL_INSTRUMENTATION_FOR := ImfTest
include $(BUILD_PACKAGE)
+36
View File
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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 name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.imftest.tests">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<application>
<uses-library android:name="android.test.runner" />
</application>
<!--
This declares that this app uses the instrumentation test runner targeting
the package of com.android.imftest. To run the tests use the command:
"adb shell am instrument -w com.android.imftest.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.imftest"
android:label="imf tests"/>
</manifest>
@@ -0,0 +1,49 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BigEditTextActivityNonScrollablePanScanTests extends ImfBaseTestCase<BigEditTextActivityNonScrollablePanScan> {
public final String TAG = "BigEditTextActivityNonScrollablePanScanTests";
public BigEditTextActivityNonScrollablePanScanTests() {
super(BigEditTextActivityNonScrollablePanScan.class);
}
@LargeTest
public void testAppAdjustmentPanScan() {
// Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BigEditTextActivityNonScrollablePanScan) mTargetActivity).getRootView();
View servedView = ((BigEditTextActivityNonScrollablePanScan) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,48 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BigEditTextActivityNonScrollableResizeTests extends ImfBaseTestCase<BigEditTextActivityNonScrollableResize> {
public final String TAG = "BigEditTextActivityNonScrollableResizeTests";
public BigEditTextActivityNonScrollableResizeTests() {
super(BigEditTextActivityNonScrollableResize.class);
}
@LargeTest
public void testAppAdjustmentPanScan() { // Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BigEditTextActivityNonScrollableResize) mTargetActivity).getRootView();
View servedView = ((BigEditTextActivityNonScrollableResize) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,48 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BigEditTextActivityScrollablePanScanTests extends ImfBaseTestCase<BigEditTextActivityScrollablePanScan> {
public final String TAG = "BigEditTextActivityScrollablePanScanTests";
public BigEditTextActivityScrollablePanScanTests() {
super(BigEditTextActivityScrollablePanScan.class);
}
@LargeTest
public void testAppAdjustmentPanScan() { // Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BigEditTextActivityScrollablePanScan) mTargetActivity).getRootView();
View servedView = ((BigEditTextActivityScrollablePanScan) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,49 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BigEditTextActivityScrollableResizeTests extends ImfBaseTestCase<BigEditTextActivityScrollableResize> {
public final String TAG = "BigEditTextActivityScrollableResizeTests";
public BigEditTextActivityScrollableResizeTests() {
super(BigEditTextActivityScrollableResize.class);
}
@LargeTest
public void testAppAdjustmentPanScan() {
// Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BigEditTextActivityScrollableResize) mTargetActivity).getRootView();
View servedView = ((BigEditTextActivityScrollableResize) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,49 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BottomEditTextActivityPanScanTests extends ImfBaseTestCase<BottomEditTextActivityPanScan> {
public final String TAG = "BottomEditTextActivityPanScanTests";
public BottomEditTextActivityPanScanTests() {
super(BottomEditTextActivityPanScan.class);
}
@LargeTest
public void testAppAdjustmentPanScan() {
// Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BottomEditTextActivityPanScan) mTargetActivity).getRootView();
View servedView = ((BottomEditTextActivityPanScan) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,49 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import com.android.imftest.R;
public class BottomEditTextActivityResizeTests extends ImfBaseTestCase<BottomEditTextActivityResize> {
public final String TAG = "BottomEditTextActivityResizeTests";
public BottomEditTextActivityResizeTests() {
super(BottomEditTextActivityResize.class);
}
@LargeTest
public void testAppAdjustmentResize() {
// Give the IME 2 seconds to appear.
pause(2000);
View rootView = ((BottomEditTextActivityResize) mTargetActivity).getRootView();
View servedView = ((BottomEditTextActivityResize) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,58 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
import android.widget.Button;
public class ButtonActivityTest extends ImfBaseTestCase<ButtonActivity> {
final public String TAG = "ButtonActivityTest";
public ButtonActivityTest() {
super(ButtonActivity.class);
}
@LargeTest
public void testButtonActivatesIme() {
final Button button = (Button) mTargetActivity.findViewById(ButtonActivity.BUTTON_ID);
// Push button
// Bring the target EditText into focus.
mTargetActivity.runOnUiThread(new Runnable() {
public void run() {
button.requestFocus();
}
});
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
// Give it a couple seconds
pause(2000);
// We should have initialized imm.mServedView and imm.mCurrentTextBoxAttribute
assertTrue(mImm.isActive());
// imm.mServedInputConnection should be null since Button doesn't override onCreateInputConnection().
assertFalse(mImm.isAcceptingText());
destructiveCheckImeInitialState(mTargetActivity.getRootView(), button);
}
}
@@ -0,0 +1,149 @@
/*
* 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 com.android.imftest.samples;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.SystemClock;
import android.test.InstrumentationTestCase;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import com.android.imftest.R;
public abstract class ImfBaseTestCase<T extends Activity> extends InstrumentationTestCase {
/*
* The amount of time we are willing to wait for the IME to appear after a user action
* before we give up and fail the test.
*/
public final long WAIT_FOR_IME = 5000;
/*
* Unfortunately there is now way for us to know how tall the IME is,
* so we have to hard code a minimum and maximum value.
*/
public final int IME_MIN_HEIGHT = 150;
public final int IME_MAX_HEIGHT = 300;
protected InputMethodManager mImm;
protected T mTargetActivity;
protected boolean mExpectAutoPop;
private Class<T> mTargetActivityClass;
public ImfBaseTestCase(Class<T> activityClass) {
mTargetActivityClass = activityClass;
}
@Override
public void setUp() throws Exception {
super.setUp();
final String packageName = getInstrumentation().getTargetContext().getPackageName();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
mTargetActivity = launchActivityWithIntent(packageName, mTargetActivityClass, intent);
// expect ime to auto pop up if device has no hard keyboard
int keyboardType = mTargetActivity.getResources().getConfiguration().keyboard;
mExpectAutoPop = (keyboardType == Configuration.KEYBOARD_NOKEYS ||
keyboardType == Configuration.KEYBOARD_UNDEFINED);
mImm = InputMethodManager.getInstance(mTargetActivity);
KeyguardManager keyguardManager =
(KeyguardManager) getInstrumentation().getContext().getSystemService(
Context.KEYGUARD_SERVICE);
keyguardManager.newKeyguardLock("imftest").disableKeyguard();
}
// Utility test methods
public void verifyEditTextAdjustment(final View editText, int rootViewHeight) {
int[] origLocation = new int[2];
int[] newLocation = new int[2];
// Tell the keyboard to go away.
mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
// Bring the target EditText into focus.
mTargetActivity.runOnUiThread(new Runnable() {
public void run() {
editText.requestFocus();
}
});
// Get the original location of the EditText.
editText.getLocationOnScreen(origLocation);
// Tap the EditText to bring up the IME.
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
// Wait until the EditText pops above the IME or until we hit the timeout.
editText.getLocationOnScreen(newLocation);
long timeoutTime = SystemClock.uptimeMillis() + WAIT_FOR_IME;
while (newLocation[1] > rootViewHeight - IME_MIN_HEIGHT && SystemClock.uptimeMillis() < timeoutTime) {
editText.getLocationOnScreen(newLocation);
pause(100);
}
assertTrue(newLocation[1] <= rootViewHeight - IME_MIN_HEIGHT);
// Tell the keyboard to go away.
mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
public void destructiveCheckImeInitialState(View rootView, View servedView) {
int windowSoftInputMode = mTargetActivity.getWindow().getAttributes().softInputMode;
int adjustMode = windowSoftInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
if (mExpectAutoPop && adjustMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
assertTrue(destructiveCheckImeUp(rootView, servedView));
} else {
assertFalse(destructiveCheckImeUp(rootView, servedView));
}
}
public boolean destructiveCheckImeUp(View rootView, View servedView) {
int origHeight;
int newHeight;
origHeight = rootView.getHeight();
// Tell the keyboard to go away.
mImm.hideSoftInputFromWindow(servedView.getWindowToken(), 0);
// Give it five seconds to adjust
newHeight = rootView.getHeight();
long timeoutTime = SystemClock.uptimeMillis() + WAIT_FOR_IME;
while (Math.abs(newHeight - origHeight) < IME_MIN_HEIGHT && SystemClock.uptimeMillis() < timeoutTime) {
newHeight = rootView.getHeight();
}
return (Math.abs(origHeight - newHeight) >= IME_MIN_HEIGHT);
}
void pause(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
}
}
}
@@ -0,0 +1,40 @@
/*
* 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 com.android.imftest.samples;
import android.app.Activity;
import android.widget.EditText;
public abstract class ManyEditTextActivityBaseTestCase<T extends Activity> extends ImfBaseTestCase<T> {
public ManyEditTextActivityBaseTestCase(Class<T> activityClass){
super(activityClass);
}
public abstract void testAllEditTextsAdjust();
public void verifyAllEditTextAdjustment(int numEditTexts, int rootViewHeight) {
for (int i = 0; i < numEditTexts; i++) {
final EditText lastEditText = (EditText) mTargetActivity.findViewById(i);
verifyEditTextAdjustment(lastEditText, rootViewHeight);
}
}
}
@@ -0,0 +1,36 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
public class ManyEditTextActivityNoScrollPanScanTests extends ManyEditTextActivityBaseTestCase<ManyEditTextActivityNoScrollPanScan> {
public final String TAG = "ManyEditTextActivityNoScrollPanScanTests";
public ManyEditTextActivityNoScrollPanScanTests() {
super(ManyEditTextActivityNoScrollPanScan.class);
}
@LargeTest
public void testAllEditTextsAdjust() {
verifyAllEditTextAdjustment(mTargetActivity.NUM_EDIT_TEXTS,
mTargetActivity.getRootView().getMeasuredHeight());
}
}
@@ -0,0 +1,37 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
public class ManyEditTextActivityScrollPanScanTests extends ManyEditTextActivityBaseTestCase<ManyEditTextActivityScrollPanScan> {
public final String TAG = "ManyEditTextActivityScrollPanScanTests";
public ManyEditTextActivityScrollPanScanTests() {
super(ManyEditTextActivityScrollPanScan.class);
}
@LargeTest
public void testAllEditTextsAdjust() {
verifyAllEditTextAdjustment(mTargetActivity.NUM_EDIT_TEXTS,
mTargetActivity.getRootView().getMeasuredHeight());
}
}
@@ -0,0 +1,37 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
public class ManyEditTextActivityScrollResizeTests extends ManyEditTextActivityBaseTestCase<ManyEditTextActivityScrollResize> {
public final String TAG = "ManyEditTextActivityScrollResizeTests";
public ManyEditTextActivityScrollResizeTests() {
super(ManyEditTextActivityScrollResize.class);
}
@LargeTest
public void testAllEditTextsAdjust() {
verifyAllEditTextAdjustment(mTargetActivity.NUM_EDIT_TEXTS,
mTargetActivity.getRootView().getMeasuredHeight());
}
}
@@ -0,0 +1,50 @@
/*
* 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 com.android.imftest.samples;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
public class OneEditTextActivityNotSelectedTests extends ImfBaseTestCase<OneEditTextActivityNotSelected> {
public final String TAG = "OneEditTextActivityNotSelectedTests";
public OneEditTextActivityNotSelectedTests() {
super(OneEditTextActivityNotSelected.class);
}
@LargeTest
public void testSoftKeyboardNoAutoPop() {
// Give the IME 2 seconds to appear.
pause(2000);
assertFalse(mImm.isAcceptingText());
View rootView = ((OneEditTextActivityNotSelected) mTargetActivity).getRootView();
View servedView = ((OneEditTextActivityNotSelected) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}
@@ -0,0 +1,53 @@
/*
* 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 com.android.imftest.samples;
import com.android.imftest.R;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
import android.view.View;
public class OneEditTextActivitySelectedTests extends ImfBaseTestCase<OneEditTextActivitySelected> {
public final String TAG = "OneEditTextActivitySelectedTests";
public OneEditTextActivitySelectedTests() {
super(OneEditTextActivitySelected.class);
}
@LargeTest
public void testSoftKeyboardAutoPop() {
// Give the IME 2 seconds to appear.
pause(2000);
assertTrue(mImm.isAcceptingText());
View rootView = ((OneEditTextActivitySelected) mTargetActivity).getRootView();
View servedView = ((OneEditTextActivitySelected) mTargetActivity).getDefaultFocusedView();
assertNotNull(rootView);
assertNotNull(servedView);
destructiveCheckImeInitialState(rootView, servedView);
verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
}