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 17 package android.widget.layout.linear; 18 19 import android.app.Activity; 20 import android.os.Bundle; 21 import android.view.View; 22 23 import com.android.frameworks.coretests.R; 24 25 public class LLOfTwoFocusableInTouchMode extends Activity { 26 27 private View mButton1; 28 private View mButton2; 29 private View mButton3; 30 31 private boolean mB1Fired = false; 32 private boolean mB2Fired = false; 33 private boolean mB3Fired = false; 34 35 @Override onCreate(Bundle savedInstanceState)36 protected void onCreate(Bundle savedInstanceState) { 37 super.onCreate(savedInstanceState); 38 39 setContentView(R.layout.linear_layout_buttons); 40 41 mButton1 = findViewById(R.id.button1); 42 mButton2 = findViewById(R.id.button2); 43 mButton3 = findViewById(R.id.button3); 44 45 mButton1.setFocusableInTouchMode(true); 46 mButton2.setFocusableInTouchMode(true); 47 mButton3.setFocusableInTouchMode(true); 48 49 mButton1.setOnClickListener(new View.OnClickListener() { 50 public void onClick(View v) { 51 mB1Fired = true; 52 } 53 }); 54 55 mButton2.setOnClickListener(new View.OnClickListener() { 56 public void onClick(View v) { 57 mB2Fired = true; 58 } 59 }); 60 61 mButton3.setOnClickListener(new View.OnClickListener() { 62 public void onClick(View v) { 63 mB3Fired = true; 64 } 65 }); 66 getWindow().getDecorView().restoreDefaultFocus(); 67 } 68 getButton1()69 public View getButton1() { 70 return mButton1; 71 } 72 getButton2()73 public View getButton2() { 74 return mButton2; 75 } 76 getButton3()77 public View getButton3() { 78 return mButton3; 79 } 80 isB1Fired()81 public boolean isB1Fired() { 82 return mB1Fired; 83 } 84 isB2Fired()85 public boolean isB2Fired() { 86 return mB2Fired; 87 } 88 isB3Fired()89 public boolean isB3Fired() { 90 return mB3Fired; 91 } 92 } 93