1/*
2 * Copyright (C) 2009 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
17package com.android.imftest.samples;
18
19import android.app.Activity;
20import android.os.Bundle;
21import android.os.Debug;
22import android.view.KeyEvent;
23import android.view.View;
24import android.view.ViewGroup;
25import android.view.WindowManager;
26import android.widget.LinearLayout;
27import android.view.inputmethod.InputMethodManager;
28import android.widget.EditText;
29import android.widget.Button;
30import android.widget.TextView;
31import android.widget.ScrollView;
32
33import com.android.internal.R;
34
35/*
36 * Activity with non-EditText view selected initially
37 */
38public class OneEditTextActivityNotSelected extends Activity
39{
40    private View mRootView;
41    private View mDefaultFocusedView;
42
43    @Override
44    public void onCreate(Bundle savedInstanceState)
45    {
46        super.onCreate(savedInstanceState);
47
48        LinearLayout layout = new LinearLayout(this);
49        layout.setOrientation(LinearLayout.VERTICAL);
50        mRootView = new ScrollView(this);
51
52        EditText editText = new EditText(this);
53        Button button = new Button(this);
54        button.setText("The focus is here.");
55        button.setFocusableInTouchMode(true);
56        button.requestFocus();
57        mDefaultFocusedView = button;
58        layout.addView(button);
59        layout.addView(editText);
60
61        ((ScrollView) mRootView).addView(layout);
62        setContentView(mRootView);
63    }
64
65    public View getRootView() {
66        return mRootView;
67    }
68
69    public View getDefaultFocusedView() {
70        return mDefaultFocusedView;
71    }
72}
73