Search in sources :

Example 71 with Spinner

use of android.widget.Spinner in project android_frameworks_base by crdroidandroid.

the class ScrollingTabContainerView method createSpinner.

private Spinner createSpinner() {
    final Spinner spinner = new Spinner(getContext(), null, com.android.internal.R.attr.actionDropDownStyle);
    spinner.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
    spinner.setOnItemClickListenerInt(this);
    return spinner;
}
Also used : Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Example 72 with Spinner

use of android.widget.Spinner in project pictureapp by EyeSeeTea.

the class DynamicTabAdapter method showDefaultValue.

private void showDefaultValue(TableRow tableRow, Question rowQuestion) {
    if (rowQuestion.getValueBySession() != null) {
        return;
    }
    switch(rowQuestion.getOutput()) {
        case Constants.PHONE:
        case Constants.POSITIVE_INT:
        case Constants.POSITIVE_OR_ZERO_INT:
        case Constants.INT:
        case Constants.LONG_TEXT:
        case Constants.SHORT_TEXT:
            final CustomEditText editCard = (CustomEditText) tableRow.findViewById(R.id.answer);
            editCard.setText("");
            break;
        case Constants.DROPDOWN_LIST:
        case Constants.DROPDOWN_OU_LIST:
            Spinner dropdown = (Spinner) tableRow.findViewById(R.id.answer);
            dropdown.setSelection(0);
            break;
        case Constants.SWITCH_BUTTON:
            Switch switchView = (Switch) tableRow.findViewById(R.id.answer);
            Option selectedOption = rowQuestion.getOptionBySession();
            if (selectedOption == null) {
                //the 0 option is the left option and is false in the switch, the 1 option is
                // the right option and is true
                boolean isChecked = false;
                if (rowQuestion.getAnswer().getOptions().get(1).getOptionAttribute().getDefaultOption() == 1) {
                    isChecked = true;
                }
                saveSwitchOption(rowQuestion, isChecked);
                switchView.setChecked(isChecked);
                break;
            }
            switchView.setChecked(findSwitchBoolean(rowQuestion));
            break;
    }
}
Also used : Switch(android.widget.Switch) CustomEditText(org.eyeseetea.sdk.presentation.views.CustomEditText) Spinner(android.widget.Spinner) QuestionOption(org.eyeseetea.malariacare.data.database.model.QuestionOption) ImageRadioButtonOption(org.eyeseetea.malariacare.views.option.ImageRadioButtonOption) Option(org.eyeseetea.malariacare.data.database.model.Option)

Example 73 with Spinner

use of android.widget.Spinner in project ngAndroid by davityle.

the class NgChange method attach.

@Override
public void attach(Scope scope, View view, int layoutId, int viewId, Tuple<String, String>[] models) {
    Executor executor = new Executor(scope, layoutId, viewId, getAttribute());
    if (view instanceof CompoundButton) {
        CompoundButton button = (CompoundButton) view;
        button.setOnCheckedChangeListener(executor);
    } else if (view instanceof TextView) {
        TextView textView = (TextView) view;
        textView.addTextChangedListener(executor);
    } else if (view instanceof Spinner) {
        Spinner spinner = (Spinner) view;
        spinner.setOnItemSelectedListener(executor);
    } else if (view instanceof RadioGroup) {
        RadioGroup group = (RadioGroup) view;
        group.setOnCheckedChangeListener(executor);
    }
}
Also used : RadioGroup(android.widget.RadioGroup) Spinner(android.widget.Spinner) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Example 74 with Spinner

use of android.widget.Spinner in project android_frameworks_base by crdroidandroid.

the class ActionBarView method setNavigationMode.

public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch(oldMode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mListNavLayout != null) {
                    removeView(mListNavLayout);
                }
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    removeView(mTabScrollView);
                }
        }
        switch(mode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mSpinner == null) {
                    mSpinner = new Spinner(mContext, null, com.android.internal.R.attr.actionDropDownStyle);
                    mSpinner.setId(com.android.internal.R.id.action_bar_spinner);
                    mListNavLayout = new LinearLayout(mContext, null, com.android.internal.R.attr.actionBarTabBarStyle);
                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                    params.gravity = Gravity.CENTER;
                    mListNavLayout.addView(mSpinner, params);
                }
                if (mSpinner.getAdapter() != mSpinnerAdapter) {
                    mSpinner.setAdapter(mSpinnerAdapter);
                }
                mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
                addView(mListNavLayout);
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    addView(mTabScrollView);
                }
                break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
Also used : Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Example 75 with Spinner

use of android.widget.Spinner in project android_frameworks_base by crdroidandroid.

the class SurfaceCompositionMeasuringActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    // Detect Andromeda devices by having free-form window management feature.
    mAndromeda = getPackageManager().hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT);
    detectRefreshRate();
    // To layouts in parent. First contains list of Surfaces and second
    // controls. Controls stay on top.
    RelativeLayout rootLayout = new RelativeLayout(this);
    rootLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    CustomLayout layout = new CustomLayout(this);
    layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    Rect rect = new Rect();
    getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
    mWidth = rect.right;
    mHeight = rect.bottom;
    long maxMemoryPerSurface = roundToNextPowerOf2(mWidth) * roundToNextPowerOf2(mHeight) * 4;
    // Use 75% of available memory.
    int surfaceCnt = (int) ((getMemoryInfo().availMem * 3) / (4 * maxMemoryPerSurface));
    if (surfaceCnt < MIN_NUMBER_OF_SURFACES) {
        throw new RuntimeException("Not enough memory to allocate " + MIN_NUMBER_OF_SURFACES + " surfaces.");
    }
    if (surfaceCnt > MAX_NUMBER_OF_SURFACES) {
        surfaceCnt = MAX_NUMBER_OF_SURFACES;
    }
    LinearLayout controlLayout = new LinearLayout(this);
    controlLayout.setOrientation(LinearLayout.VERTICAL);
    controlLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mMeasureCompositionButton = createButton("Compositor speed.", controlLayout);
    mMeasureAllocationButton = createButton("Allocation speed", controlLayout);
    String[] pixelFomats = new String[PIXEL_FORMATS.length];
    for (int i = 0; i < pixelFomats.length; ++i) {
        pixelFomats[i] = getPixelFormatInfo(PIXEL_FORMATS[i]);
    }
    mPixelFormatSelector = new Spinner(this);
    ArrayAdapter<String> pixelFormatSelectorAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, pixelFomats);
    pixelFormatSelectorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mPixelFormatSelector.setAdapter(pixelFormatSelectorAdapter);
    mPixelFormatSelector.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    controlLayout.addView(mPixelFormatSelector);
    mResultView = new TextView(this);
    mResultView.setBackgroundColor(0);
    mResultView.setText("Press button to start test.");
    mResultView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    controlLayout.addView(mResultView);
    mSystemInfoView = new TextView(this);
    mSystemInfoView.setBackgroundColor(0);
    mSystemInfoView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    controlLayout.addView(mSystemInfoView);
    for (int i = 0; i < surfaceCnt; ++i) {
        CustomSurfaceView view = new CustomSurfaceView(this, "Surface:" + i);
        // to mark as media overlay.
        if (i == 0) {
            view.setLayoutParams(new CustomLayout.LayoutParams(0, 0, mWidth, mHeight));
            view.setZOrderMediaOverlay(false);
        } else {
            // Z order of other layers is not predefined so make offset on x and reverse
            // offset on y to make sure that surface is visible in any layout.
            int x = i;
            int y = (surfaceCnt - i);
            view.setLayoutParams(new CustomLayout.LayoutParams(x, y, x + mWidth, y + mHeight));
            view.setZOrderMediaOverlay(true);
        }
        view.setVisibility(View.INVISIBLE);
        layout.addView(view);
        mViews.add(view);
    }
    rootLayout.addView(layout);
    rootLayout.addView(controlLayout);
    setContentView(rootLayout);
}
Also used : Rect(android.graphics.Rect) ViewGroup(android.view.ViewGroup) Spinner(android.widget.Spinner) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

Spinner (android.widget.Spinner)160 View (android.view.View)70 AdapterView (android.widget.AdapterView)58 TextView (android.widget.TextView)51 ArrayAdapter (android.widget.ArrayAdapter)50 LinearLayout (android.widget.LinearLayout)29 EditText (android.widget.EditText)20 Intent (android.content.Intent)19 Button (android.widget.Button)19 RecyclerView (android.support.v7.widget.RecyclerView)18 CompoundButton (android.widget.CompoundButton)16 ViewGroup (android.view.ViewGroup)13 ImageView (android.widget.ImageView)13 DialogInterface (android.content.DialogInterface)12 CheckBox (android.widget.CheckBox)11 ListView (android.widget.ListView)11 ArrayList (java.util.ArrayList)11 AutoCompleteTextView (android.widget.AutoCompleteTextView)9 AlertDialog (android.app.AlertDialog)7 LayoutInflater (android.view.LayoutInflater)7