Home | History | Annotate | Download | only in linear
      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 com.android.frameworks.coretests.R;
     20 
     21 import android.app.Activity;
     22 import android.os.Bundle;
     23 import android.view.View;
     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
     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     }
     67 
     68     public View getButton1() {
     69         return mButton1;
     70     }
     71 
     72     public View getButton2() {
     73         return mButton2;
     74     }
     75 
     76     public View getButton3() {
     77         return mButton3;
     78     }
     79 
     80     public boolean isB1Fired() {
     81         return mB1Fired;
     82     }
     83 
     84     public boolean isB2Fired() {
     85         return mB2Fired;
     86     }
     87 
     88     public boolean isB3Fired() {
     89         return mB3Fired;
     90     }
     91 }
     92