The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Neal Nguyen | 1d3165f | 2010-01-12 13:26:10 -0800 | [diff] [blame] | 17 | package android.view; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 | |
| 19 | import android.app.Activity; |
| 20 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.view.View.OnClickListener; |
| 22 | import android.widget.ArrayAdapter; |
| 23 | import android.widget.AutoCompleteTextView; |
| 24 | import android.widget.Button; |
| 25 | import android.widget.Spinner; |
| 26 | |
Neal Nguyen | 1d3165f | 2010-01-12 13:26:10 -0800 | [diff] [blame] | 27 | import com.android.frameworks.coretests.R; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Tests views with popupWindows becoming invisible |
| 31 | */ |
| 32 | public class PopupWindowVisibility extends Activity implements OnClickListener { |
| 33 | |
| 34 | private View mFrame; |
| 35 | private Button mHide; |
| 36 | private Button mShow; |
| 37 | |
| 38 | |
| 39 | |
| 40 | @Override |
| 41 | protected void onCreate(Bundle icicle) { |
| 42 | super.onCreate(icicle); |
| 43 | setContentView(R.layout.popup_window_visibility); |
| 44 | |
| 45 | mFrame = findViewById(R.id.frame); |
| 46 | |
Alan Viverette | 51efddb | 2017-04-05 10:00:01 -0400 | [diff] [blame] | 47 | mHide = findViewById(R.id.hide); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | mHide.setOnClickListener(this); |
| 49 | |
Alan Viverette | 51efddb | 2017-04-05 10:00:01 -0400 | [diff] [blame] | 50 | mShow = findViewById(R.id.show); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | mShow.setOnClickListener(this); |
| 52 | |
Alan Viverette | 51efddb | 2017-04-05 10:00:01 -0400 | [diff] [blame] | 53 | Spinner spinner = findViewById(R.id.spinner); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, |
| 55 | android.R.layout.simple_spinner_item, mStrings); |
| 56 | spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
| 57 | spinner.setAdapter(spinnerAdapter); |
| 58 | |
| 59 | ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(this, |
| 60 | android.R.layout.simple_dropdown_item_1line, COUNTRIES); |
Alan Viverette | 51efddb | 2017-04-05 10:00:01 -0400 | [diff] [blame] | 61 | AutoCompleteTextView textView = findViewById(R.id.auto); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | textView.setAdapter(autoAdapter); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | public void onClick(View v) { |
| 67 | mFrame.setVisibility(v == mHide ? View.INVISIBLE : View.VISIBLE); |
| 68 | } |
| 69 | private static final String[] mStrings = { |
| 70 | "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" |
| 71 | }; |
| 72 | |
| 73 | static final String[] COUNTRIES = new String[] { |
| 74 | "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", |
| 75 | "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", |
| 76 | "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", |
| 77 | "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", |
| 78 | "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", |
| 79 | "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", |
| 80 | "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", |
| 81 | "Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde", |
| 82 | "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", |
| 83 | "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", |
Fredrik Roubert | 45ded8f | 2017-02-22 22:17:11 +0100 | [diff] [blame] | 84 | "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czechia", |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic", |
| 86 | "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", |
| 87 | "Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland", |
| 88 | "Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia", |
| 89 | "French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar", |
| 90 | "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", |
| 91 | "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary", |
| 92 | "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", |
| 93 | "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos", |
| 94 | "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", |
| 95 | "Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", |
| 96 | "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", |
| 97 | "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", |
| 98 | "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", |
| 99 | "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas", |
| 100 | "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", |
| 101 | "Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar", |
| 102 | "Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena", |
| 103 | "Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon", |
| 104 | "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal", |
| 105 | "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", |
| 106 | "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea", |
| 107 | "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden", |
| 108 | "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas", |
| 109 | "The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", |
| 110 | "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda", |
| 111 | "Ukraine", "United Arab Emirates", "United Kingdom", |
| 112 | "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", |
| 113 | "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara", |
| 114 | "Yemen", "Yugoslavia", "Zambia", "Zimbabwe" |
| 115 | }; |
| 116 | } |