Example usage for android.widget Spinner setEnabled

List of usage examples for android.widget Spinner setEnabled

Introduction

In this page you can find the example usage for android.widget Spinner setEnabled.

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:com.rightscale.app.dashboard.ShowServerMonitoring.java

public void consumeContentError(Throwable t, String tag) {
    Spinner spinner = (Spinner) findViewById(R.id.show_server_monitoring_spinner);
    spinner.setEnabled(false);

    consumeImage(null, null);//from ww w .j av  a 2s.  c om

    //We get RestException (422) when there is no monitoring for a server, and for some reason we see it
    //as RestAuthException here. In this particular view, rather than displaying an error dialog, we
    //just swallow the error (but hide the throbber).
    if (t.getCause() instanceof RestException) {
        _helper.hideThrobber(true);

    } else {
        _helper.onConsumeContentError(t);
    }
}

From source file:com.tassadar.multirommgr.installfragment.InstallCard.java

@Override
public void onCheckedChanged(CompoundButton btn, boolean checked) {
    if (btn.getId() == R.id.install_kernel) {
        Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options);
        s.setEnabled(checked);
    }//  w ww.ja va  2s. co  m
    enableInstallBtn();
}

From source file:com.rightscale.app.dashboard.ShowServerMonitoring.java

public void consumeContent(Cursor cursor, String tag) {
    super.consumeContent(cursor, tag);

    if (tag == MONITORS) {
        _cursor = cursor;/*w  w  w  .  ja v  a 2s  .  co m*/
        startManagingCursor(cursor);
        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item,
                cursor, FROM, TO);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        Spinner spinner = (Spinner) findViewById(R.id.show_server_monitoring_spinner);
        spinner.setEnabled(true);
        spinner.setAdapter(adapter);
        spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                int colHref = _cursor.getColumnIndexOrThrow("href");
                _cursor.moveToPosition(position);
                String href = _cursor.getString(colHref);
                showGraph(href, DEFAULT_SIZE, DEFAULT_PERIOD);
            }

            public void onNothingSelected(AdapterView<?> arg0) {
                //TODO: clear the monitoring graph (fade out, oooh!)
            }
        });
    }
}

From source file:se.hockersten.timed.vibration.main.PracticeTab.java

private void updateUI() {
    Button startBtn = (Button) root.findViewById(R.id.mainPractice_btnStart);
    Spinner spinFirst = (Spinner) root.findViewById(R.id.mainPractice_spinIntervalFirst);
    Spinner spinSecond = (Spinner) root.findViewById(R.id.mainPractice_spinIntervalSecond);
    spinFirst.setEnabled(!counting);
    spinSecond.setEnabled(!counting);/* www  . j  a  v a 2 s. c om*/
    if (counting) {
        startBtn.setText(R.string.Stop_counting);
    } else {
        startBtn.setText(R.string.Start_counting);
    }
}

From source file:quartyard.loanshark.PageFragment.java

void addCheckListeners() {
    _cbs.put(Value.principal, _chkPrincipal);
    _cbs.put(Value.ari, _chkAPR);/*  w ww.ja va2s  . c o m*/
    _cbs.put(Value.payment, _chkPayment);
    _cbs.put(Value.length, _chkLength);
    _tbs.put(Value.principal, _txtPrincipal);
    _tbs.put(Value.ari, _txtAPR);
    _tbs.put(Value.payment, _txtPayment);
    _tbs.put(Value.length, _txtLength);
    _spinners.put(Value.length, _spnLength);

    for (Value v : _cbs.keySet()) {
        final Value val = v;
        final CheckBox cb = _cbs.get(val);
        cb.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View x) {
                cb.setEnabled(false);
                cb.setChecked(true);
                _loan.compute(val);
                for (Value v : _cbs.keySet()) {
                    if (v != val) {
                        CheckBox othr = _cbs.get(v);
                        othr.setChecked(false);
                        othr.setEnabled(true);
                    }
                }
                for (Value v : _tbs.keySet()) {
                    EditText tb = _tbs.get(v);
                    if (v != val) {
                        tb.setEnabled(true);
                    } else {
                        tb.setEnabled(false);
                    }
                }
                for (Value v : _spinners.keySet()) {
                    Spinner s = _spinners.get(v);
                    if (v != val) {
                        s.setEnabled(true);
                    } else {
                        s.setEnabled(false);
                    }
                }

                //APR-AS-TARGET not yet implemented.  So disable the checkbox.
                _chkAPR.setEnabled(false); // !!!  TEMPORARY !!! //
            }
        });
    }
}

From source file:com.tassadar.multirommgr.installfragment.InstallCard.java

@Override
public View getCardContent(Context context) {
    m_view = LayoutInflater.from(context).inflate(R.layout.install_card, null);

    Resources res = m_view.getResources();

    CheckBox b = (CheckBox) m_view.findViewById(R.id.install_multirom);
    b.setText(res.getString(R.string.install_multirom, m_manifest.getMultiromVersion()));
    b.setChecked(m_manifest.hasMultiromUpdate());
    b.setOnCheckedChangeListener(this);

    b = (CheckBox) m_view.findViewById(R.id.install_recovery);
    if (m_manifest.getRecoveryFile() != null) {
        final Date rec_date = m_manifest.getRecoveryVersion();
        final String recovery_ver = Recovery.DISPLAY_FMT.format(rec_date);
        b.setText(res.getString(R.string.install_recovery, recovery_ver));
        b.setChecked(m_manifest.hasRecoveryUpdate());
        b.setOnCheckedChangeListener(this);

        // Force user to install recovery if not yet installed - it is needed to flash ZIPs
        if (m_manifest.hasRecoveryUpdate() && m_forceRecovery) {
            b.append(Html.fromHtml(res.getString(R.string.required)));
            b.setClickable(false);/*  ww  w  .j  a va 2s  . co  m*/
        }
    } else {
        b.setChecked(false);
        b.setVisibility(View.GONE);
    }

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item);
    adapter.addAll(m_manifest.getKernels().keySet());
    Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options);
    s.setAdapter(adapter);
    s.setEnabled(false);
    s.setSelection(getDefaultKernel());

    b = (CheckBox) m_view.findViewById(R.id.install_kernel);
    b.setOnCheckedChangeListener(this);
    b.setEnabled(!adapter.isEmpty());
    b.setChecked(!adapter.isEmpty() && m_manifest.hasKernelUpdate());

    Button install_btn = (Button) m_view.findViewById(R.id.install_btn);
    install_btn.setOnClickListener(this);

    ImageButton changelog_btn = (ImageButton) m_view.findViewById(R.id.changelog_btn);
    if (m_manifest.getChangelogs() == null || m_manifest.getChangelogs().length == 0)
        changelog_btn.setVisibility(View.GONE);
    else
        changelog_btn.setOnClickListener(this);

    if (m_savedState != null)
        restoreInstanceState();

    enableInstallBtn();
    return m_view;
}

From source file:org.catrobat.catroid.content.bricks.BroadcastBrick.java

@Override
public View getPrototypeView(Context context) {
    View prototypeView = View.inflate(context, R.layout.brick_broadcast, null);
    Spinner broadcastSpinner = (Spinner) prototypeView.findViewById(R.id.brick_broadcast_spinner);
    broadcastSpinner.setFocusableInTouchMode(false);
    broadcastSpinner.setFocusable(false);
    broadcastSpinner.setEnabled(false);

    SpinnerAdapter broadcastSpinnerAdapter = MessageContainer.getMessageAdapter(context);
    broadcastSpinner.setAdapter(broadcastSpinnerAdapter);
    setSpinnerSelection(broadcastSpinner);
    return prototypeView;
}

From source file:com.example.mediasync3.DownloadMusic.java

@Override
protected void onPostExecute(Boolean result) {
    mDialog.dismiss();/*w  w  w. j  av a2 s  .  c o m*/

    if (pos == -2) {
        Spinner listSpin = (Spinner) rootView.findViewById(R.id.spinner1);
        listSpin.setAdapter(adapterList);
        listSpin.setEnabled(true);

    } else {

        ListView lv = (ListView) rootView.findViewById(R.id.listView1);
        ArrayList<String> dir = new ArrayList<String>();

        //File sdCardRoot = Environment.getExternalStorageDirectory();
        final File MusicDir = new File(LOCAL_MUSIC_DIR);

        for (File f : MusicDir.listFiles()) {
            if (f.isFile())
                dir.add(f.getName());
            // Do your stuff 
        }
        String[] localnames = dir.toArray(new String[dir.size()]);

        ArrayAdapter<String> ad = new ArrayAdapter<String>(mFrag.getActivity(),
                android.R.layout.simple_list_item_1, localnames);
        lv.setAdapter(ad);

        //TextView tv = (TextView) rootView.findViewById(R.id.textView1);
        //tv.setText(fnames[pos]);

        if (result) {

            showToast(mErrorMsg);
        } else {
            // Couldn't download it, so show an error
            showToast(mErrorMsg);
        }
    }
}

From source file:com.example.mediasync3.DownloadPhoto.java

@Override
protected void onPostExecute(Boolean result) {
    mDialog.dismiss();/*from  w w w.  j  a v a2  s.  com*/

    if (pos == -2) {
        Spinner listSpin = (Spinner) rootView.findViewById(R.id.spinner1);
        listSpin.setAdapter(adapterList);
        listSpin.setEnabled(true);
    } else {

        ImageView iv = (ImageView) rootView.findViewById(R.id.image_view);

        fnames = mActivity.getPhotoNames();
        Drawable drawable = Drawable.createFromPath(LOCAL_PHOTO_DIR + "/" + fnames[pos]);
        iv.setImageDrawable(drawable);

        /*
        ListView lv = (ListView)rootView.findViewById(R.id.listView1);
        ArrayList<String> dir=new ArrayList<String>();
                
        //File sdCardRoot = Environment.getExternalStorageDirectory();
        final File PhotoDir = new File(LOCAL_PHOTO_DIR);
        for (File f : PhotoDir.listFiles()) {
           if (f.isFile())
        dir.add(f.getName());
        // Do your stuff
        }
        String[] localnames = dir.toArray(new String[dir.size()]);
                
        ArrayAdapter<String> ad = new ArrayAdapter<String>(mFrag.getActivity(), android.R.layout.simple_list_item_1,localnames);
        lv.setAdapter(ad);  
        */

        //TextView tv = (TextView) rootView.findViewById(R.id.textView1);
        //tv.setText(fnames[pos]);

    }

    if (result) {
        // Set the image now that we have it
        //    mView.setImageDrawable(mDrawable);
    } else {
        // Couldn't download it, so show an error
        //    showToast(mErrorMsg);
    }
}

From source file:org.catrobat.catroid.content.bricks.BroadcastReceiverBrick.java

@Override
public View getPrototypeView(Context context) {
    View prototypeView = View.inflate(context, R.layout.brick_broadcast_receive, null);
    Spinner broadcastReceiverSpinner = (Spinner) prototypeView
            .findViewById(R.id.brick_broadcast_receive_spinner);
    broadcastReceiverSpinner.setFocusableInTouchMode(false);
    broadcastReceiverSpinner.setFocusable(false);
    broadcastReceiverSpinner.setEnabled(false);

    SpinnerAdapter broadcastReceiverSpinnerAdapter = MessageContainer.getMessageAdapter(context);
    broadcastReceiverSpinner.setAdapter(broadcastReceiverSpinnerAdapter);
    setSpinnerSelection(broadcastReceiverSpinner);
    return prototypeView;
}