Example usage for android.widget LinearLayout setOnFocusChangeListener

List of usage examples for android.widget LinearLayout setOnFocusChangeListener

Introduction

In this page you can find the example usage for android.widget LinearLayout setOnFocusChangeListener.

Prototype

public void setOnFocusChangeListener(OnFocusChangeListener l) 

Source Link

Document

Register a callback to be invoked when focus of this view changed.

Usage

From source file:com.cssweb.android.trade.stock.StockTrading.java

@Override
public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    sc = new ServiceControl(this);//??
    ///*  w  w w.ja  va 2s  .  c  o m*/
    HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD");
    mHandlerThread.start();
    priceHandler = new PriceDataHandler(mHandlerThread.getLooper());

    setContentView(com.cssweb.android.main.R.layout.zr_trade_stock_trade);
    Bundle bundle = getIntent().getExtras();
    type = bundle.getInt("type");
    bsname = bundle.getString("bsname");
    String stockCode = bundle.getString("stkcode");

    initTitle(R.drawable.njzq_title_left_back, 0, bsname);

    LinearLayout localLinearLayout = (LinearLayout) findViewById(R.id.zrtradelayout);
    localLinearLayout.setOnFocusChangeListener(setOnEditFocusListener);
    this.m_vklayout = localLinearLayout;
    View localView1 = this.m_vklayout;
    localView1.setOnFocusChangeListener(setOnEditFocusListener);
    View localView2 = this.m_vklayout;
    localView2.setOnClickListener(setOnEditClickListener);

    viewFlipper = (ViewFlipper) this.findViewById(R.id.ViewFlipper01);
    preView = (ImageView) findViewById(R.id.previous_screen);

    leftIn = AnimationUtils.loadAnimation(this, R.anim.push_left_in_layout);
    leftOut = AnimationUtils.loadAnimation(this, R.anim.push_left_out_layout);
    rightIn = AnimationUtils.loadAnimation(this, R.anim.push_right_in_layout);
    rightOut = AnimationUtils.loadAnimation(this, R.anim.push_right_out_layout);

    priceView = (PriceMini) findViewById(R.id.zrviewprice);
    trendView = (TrendView) findViewById(R.id.zrviewtrend);
    trendView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    });
    klineView = (KlineMini) findViewById(R.id.zrviewkline);
    klineView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    });
    financeView = (FinanceMini) findViewById(R.id.zrviewfinance);

    stockHolder = (Spinner) findViewById(R.id.zrtxtaccount);
    queryMethod = (Spinner) findViewById(R.id.zrtxtbsflag);
    //      availableNum = (SeekBar) findViewById(R.id.zrcanbs);
    //      lblMaxNumber = (TextView)findViewById(R.id.txtMaxNumber);
    stkcode = (EditText) findViewById(R.id.zredtstockcode);
    stkname = (TextView) findViewById(R.id.zrtxtstockname);
    price = (EditText) findViewById(R.id.zredtprice);
    number = (EditText) findViewById(R.id.zredtcount);
    lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit);
    btn0 = (ShadowButton) findViewById(R.id.zr_surebutton);
    btn0.setOnClickListener(myShowProgreeBar);

    layoutprice0 = (LinearLayout) findViewById(R.id.LinearLayout03);
    layoutprice = (LinearLayout) findViewById(R.id.LinearLayout11);
    //layoutAvaiNumber = (LinearLayout)findViewById(R.id.LinearLayout04);
    //layoutAvaiAsset = (LinearLayout)findViewById(R.id.LinearLayout06);
    lblAvaiAsset = (TextView) findViewById(R.id.lblAvaiAsset);
    AvaiAsset = (TextView) findViewById(R.id.AvaiAsset);
    lblPrice = (TextView) findViewById(R.id.lblPrice);
    lblPrice1 = (TextView) findViewById(R.id.lblPrice1);
    lblNumber = (TextView) findViewById(R.id.lblNumber);
    avaiAsset = (TextView) findViewById(R.id.AvaiAsset);
    lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit);

    setDynamic();

    adjustDownPrice = (ImageView) findViewById(R.id.AdjustDownPrice);
    adjustDownPrice.setTag(0);
    adjustDownPrice.setOnClickListener(adjustIconListener);

    adjustUpPrice = (ImageView) findViewById(R.id.AdjustUpPrice);
    adjustUpPrice.setTag(1);
    adjustUpPrice.setOnClickListener(adjustIconListener);

    adjustDownNumber = (ImageView) findViewById(R.id.AdjustDownNumber);
    adjustDownNumber.setTag(2);
    adjustDownNumber.setOnClickListener(adjustIconListener);

    adjustUpNumber = (ImageView) findViewById(R.id.AdjustUpNumber);
    adjustUpNumber.setTag(3);
    adjustUpNumber.setOnClickListener(adjustIconListener);

    stkcode.setText(stockCode);
    if (stkcode.getText().length() == 6) {
        showProgress();
    }

    stkcode.setInputType(InputType.TYPE_NULL);
    stkcode.setFocusable(true);
    stkcode.setTag("STOCK");
    stkcode.setOnClickListener(setOnEditClickListener);
    stkcode.setOnFocusChangeListener(setOnEditFocusListener);

    price.setInputType(InputType.TYPE_NULL);
    price.setFocusable(true);
    price.setTag("NUMDOT");
    price.setOnClickListener(setOnEditClickListener);
    price.setOnFocusChangeListener(setOnEditFocusListener);

    number.setInputType(InputType.TYPE_NULL);
    number.setFocusable(true);
    number.setTag("");
    number.setOnClickListener(setOnEditClickListener);
    number.setOnFocusChangeListener(setOnEditFocusListener);

    stkcode.addTextChangedListener(new TextWatcher() {

        public void afterTextChanged(Editable arg0) {
            //queryStock(queryCode.getText());
            OnTextChanged(arg0);
        }

        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

        }

        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

        }

    });

    holder = TradeUser.getInstance().getHolder();

    stockHolderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            (String[]) holder.toArray(new String[holder.size()]));
    stockHolderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    stockHolder.setAdapter(stockHolderAdapter);

    String[] arrayOfString = getResources().getStringArray(R.array.other_market_bs_methods);
    for (int i = 0; i < arrayOfString.length; i++) {
        Log.e("arrayOfString", arrayOfString[i]);
    }

    queryMethodAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arrayOfString);
    queryMethodAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    queryMethod.setAdapter(queryMethodAdapter);
    queryMethod.setOnItemSelectedListener(new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position != 0) {
                layoutprice0.setVisibility(View.GONE);
                layoutprice.setVisibility(View.VISIBLE);
            } else {
                layoutprice0.setVisibility(View.VISIBLE);
                layoutprice.setVisibility(View.GONE);
            }
        }

        public void onNothingSelected(AdapterView<?> arg0) {

        }
    });

    int h = R.drawable.forminput;
    Resources localResources = getResources();
    Drawable localDrawable = null;
    localDrawable = localResources.getDrawable(h);
    int spinnerheight = localDrawable.getIntrinsicHeight() - 4;
    //      Log.e("<<<<<<<<<<<<<<<<<<<eeeeeeeeeeeeeeeeeeeeeeeeeee>>>>>>>>>>>>>>", String.valueOf(spinnerheight));
    LinearLayout.LayoutParams linearParams1 = (LinearLayout.LayoutParams) stockHolder.getLayoutParams();//?stockHolder?
    linearParams1.height = spinnerheight;//??
    stockHolder.setLayoutParams(linearParams1);

    LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) queryMethod.getLayoutParams();//?queryMethod?
    linearParams.height = spinnerheight;//??
    queryMethod.setLayoutParams(linearParams);
}