android.support.v7.widget.AppCompatSpinner Java Examples
The following examples show how to use
android.support.v7.widget.AppCompatSpinner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasePreferencesActivity.java From 4pdaClient-plus with Apache License 2.0 | 6 votes |
@Override public View onCreateView(String name, Context context, AttributeSet attrs) { // Allow super to try and create a view first final View result = super.onCreateView(name, context, attrs); if (result != null) { return result; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { switch (name) { case "EditText": return new AppCompatEditText(this,attrs); case "Spinner": return new AppCompatSpinner(this,attrs); case "CheckBox": return new AppCompatCheckBox(this,attrs); case "RadioButton": return new AppCompatRadioButton(this,attrs); case "CheckedTextView": return new AppCompatCheckedTextView(this,attrs); } } return null; }
Example #2
Source File: ApiDebugFragment.java From AndroidSDK with MIT License | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mLayoutInflater = inflater; View v = inflater.inflate(R.layout.fragment_api_debug, container, false); mApiUrlLayout = (TextInputLayout) v.findViewById(R.id.api_url); mRequestMethodSpinner = (AppCompatSpinner) v.findViewById(R.id.request_method_spinner); mRequestParamsTextView = (TextView) v.findViewById(R.id.request_params); mAddParamsButton = (Button) v.findViewById(R.id.add); mClearParamsButton = (Button) v.findViewById(R.id.clear); mRequestContentLayout = (TextInputLayout) v.findViewById(R.id.request_content); mSendRequestButton = (Button) v.findViewById(R.id.send); mResponseLogTextView = (TextView) v.findViewById(R.id.response_log); mAddParamsButton.setOnClickListener(this); mClearParamsButton.setOnClickListener(this); mSendRequestButton.setOnClickListener(this); return v; }
Example #3
Source File: SampleActivity.java From Material-In with Apache License 2.0 | 6 votes |
private int getSelectedGravity(AppCompatSpinner spinner) { int index = spinner.getSelectedItemPosition(); int gravity = Gravity.TOP; switch (index) { case 0: gravity = Gravity.TOP; break; case 1: gravity = Gravity.BOTTOM; break; case 2: gravity = Gravity.LEFT; break; case 3: gravity = Gravity.RIGHT; break; } return gravity; }
Example #4
Source File: GetTableFragment.java From EosCommander with MIT License | 6 votes |
private AppCompatSpinner setDropDownList(int dropDownListId, List<String> data, AdapterView.OnItemSelectedListener itemSelectedListener) { AppCompatSpinner spinner = mRootView.findViewById( dropDownListId ); if ( spinner == null ) { return null; } ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, data); adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item ); spinner.setAdapter( adapter ); if ( itemSelectedListener != null ) { spinner.setOnItemSelectedListener(itemSelectedListener); } return spinner; }
Example #5
Source File: SettingsActivity.java From EosCommander with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // di getActivityComponent().inject(this); setContentView(R.layout.activity_settings); setToolbarConfig(R.id.toolbar, true); //btn_connect 누르면 get info 를 보여준다. findViewById(R.id.btn_connect).setOnClickListener( v -> mPresenter.tryConnectNodeos( ((AppCompatSpinner)findViewById( R.id.sp_scheme)).getSelectedItem().toString() , ((TextView)findViewById(R.id.et_host)).getText() , ((TextView)findViewById(R.id.et_port)).getText()) ); mTvConnStatus = findViewById( R.id.tv_conn_status); mTvConnMsg = findViewById( R.id.tv_conn_msg); mChkSkipSigning = findViewById(R.id.cb_skip_signature); mChkSkipSigning.setOnCheckedChangeListener( ( v, checked) -> mPresenter.onChangeIgnoreSignature( checked )); mPresenter.attachView( this ); }
Example #6
Source File: SettingsActivity.java From EosCommander with MIT License | 6 votes |
private AppCompatSpinner addSpinnerData(int spinnerViewId, List<String> list, int curPosition, AdapterView.OnItemSelectedListener itemSelectedListener) { if ( list == null ) return null; ArrayAdapter<String> adapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_item, list); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); AppCompatSpinner spinner = findViewById( spinnerViewId); spinner.setAdapter( adapter ); if ( (curPosition >= 0) && ( curPosition < list.size()) ){ spinner.setSelection(curPosition); } spinner.setOnItemSelectedListener( itemSelectedListener ); return spinner; }
Example #7
Source File: SampleActivity.java From Material-In with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sample_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mSpinnerDelay = (AppCompatSpinner) findViewById(R.id.spinner_delay); mSpinnerSlide = (AppCompatSpinner) findViewById(R.id.spinner_slide); mSpinnerDelay.setAdapter(new ArrayAdapter<>(this, R.layout.spinner, mDelayGravities)); mSpinnerSlide.setAdapter(new ArrayAdapter<>(this, R.layout.spinner, mSlideGravities)); mSpinnerDelay.setSelection(1); mSpinnerSlide.setSelection(1); mSpinnerDelay.setOnItemSelectedListener(this); mSpinnerSlide.setOnItemSelectedListener(this); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setAdapter(new Adapter()); startMaterialIn(); }
Example #8
Source File: LEDActivity.java From styT with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_led); mContentLed = (TextInputEditText) findViewById(R.id.content_led); Button mFontcolorBtnLed = (Button) findViewById(R.id.fontcolor_btn_led); Button mBgcolorBtnLed = (Button) findViewById(R.id.bgcolor_btn_led); mPreviewLed = (TextView) findViewById(R.id.preview_led); ImageView mReverseColorLed = (ImageView) findViewById(R.id.reverseColor_led); mShowstyleRadiogroupLed = (RadioGroup) findViewById(R.id.showstyle_radiogroup_led); AppCompatRadioButton mSingleRadiobtnLed = (AppCompatRadioButton) findViewById(R.id.single_radiobtn_led); AppCompatRadioButton mSingleTossBtnLed = (AppCompatRadioButton) findViewById(R.id.single_toss_radiobtn_led); mRollspeedSeekbarLed = (AppCompatSeekBar) findViewById(R.id.rollspeed_seekbar_led); mAdaptiveRadiobtnLed = (AppCompatRadioButton) findViewById(R.id.adaptive_radiobtn_led); mLinesTextView = (TextView) findViewById(R.id.tv_lines_led); mlinesSeekbar = (AppCompatSeekBar) findViewById(R.id.lines_seekbar_led); AppCompatRadioButton mMagicRadiobtnLed = (AppCompatRadioButton) findViewById(R.id.magic_radiobtn_led); mCompatSpinner = (AppCompatSpinner) findViewById(R.id.spinner_magicstyle_led); Button mStartBtnLed = (AppCompatButton) findViewById(R.id.start_btn_led); if (mFontcolorBtnLed != null) { mFontcolorBtnLed.setOnClickListener(this); } if (mStartBtnLed != null) { mStartBtnLed.setOnClickListener(this); } if (mBgcolorBtnLed != null) { mBgcolorBtnLed.setOnClickListener(this); } initViewEvent(); }
Example #9
Source File: DataEntryActivity.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void setupFormSpinner() { formGroupSpinner = (AppCompatSpinner) findViewById(R.id.spinner_drop_down); if (formGroupSpinner != null) { formGroupSpinner.setVisibility(View.GONE); } }
Example #10
Source File: AppCompatPreferenceActivity.java From Android-Carbon-Forum with Apache License 2.0 | 5 votes |
@Override public View onCreateView(String name, Context context, AttributeSet attrs) { // Allow super to try and create a view first final View result = super.onCreateView(name, context, attrs); if (result != null) { return result; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // If we're running pre-L, we need to 'inject' our tint aware Views in place of the // standard framework versions switch (name) { case "EditText": return new AppCompatEditText(this, attrs); case "Spinner": return new AppCompatSpinner(this, attrs); case "CheckBox": return new AppCompatCheckBox(this, attrs); case "RadioButton": return new AppCompatRadioButton(this, attrs); case "CheckedTextView": return new AppCompatCheckedTextView(this, attrs); } } return null; }
Example #11
Source File: DownloadManagerToolbar.java From 365browser with Apache License 2.0 | 5 votes |
/** * Initializes the spinner for the download filter. * @param adapter The adapter associated with the spinner. */ public void initializeFilterSpinner(FilterAdapter adapter) { mSpinner = new AppCompatSpinner(this.getContext()); mSpinner.setAdapter(adapter); mSpinner.setOnItemSelectedListener(adapter); addView(mSpinner); }
Example #12
Source File: SelectorItem.java From Puff-Android with MIT License | 5 votes |
@Override public void setupView(View view) { AppCompatSpinner spinner = (AppCompatSpinner)view.findViewById(R.id.settings_spinner); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(onItemSelectedListener); if (selectedPos != -1) spinner.setSelection(selectedPos); }
Example #13
Source File: SettingsActivity.java From Liapp with Apache License 2.0 | 5 votes |
@Override public View onCreateView(String name, Context context, AttributeSet attrs) { // Allow super to try and create a view first final View result = super.onCreateView(name, context, attrs); if (result != null) { return result; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // If we're running pre-L, we need to 'inject' our tint aware Views in place of the // standard framework versions switch (name) { case "EditText": return new AppCompatEditText(this, attrs); case "Spinner": return new AppCompatSpinner(this, attrs); case "CheckBox": return new AppCompatCheckBox(this, attrs); case "RadioButton": return new AppCompatRadioButton(this, attrs); case "CheckedTextView": return new AppCompatCheckedTextView(this, attrs); } } return null; }
Example #14
Source File: SettingsDialogFragment.java From VideoRecorder with Apache License 2.0 | 5 votes |
private void initSpinner(final AppCompatSpinner sp, List<String> list, String key, final Callback callback) { if (list == null) return; Camera.Parameters cameraParameters = mCameraController.getCameraParameters(); final ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, list); sp.setAdapter(adapter); sp.setSelection(adapter.getPosition(cameraParameters.get(key)), false); sp.setOnItemSelectedListener(new SimpleItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { callback.set(adapter.getItem(position)); } }); }
Example #15
Source File: FeedbackDialog.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { View rootView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_feedback_layout, null); feedback = feedback == null ? ModelFactory.getFeedback() : feedback; feedback.setFeedbackType(FeedbackType.ABRUPT_CRASH); etEmail = rootView.findViewById(R.id.et_email); TextInputLayout tilEmail = rootView.findViewById(R.id.til_email); etEmail.addTextChangedListener(new EmailFormatWatcher(tilEmail)); etQuestion = rootView.findViewById(R.id.et_question); WatcherTextView wtQuestion = rootView.findViewById(R.id.wt_question); wtQuestion.bindEditText(etQuestion); AppCompatSpinner spFeedbackTypes = rootView.findViewById(R.id.sp_feedback_types); spFeedbackTypes.setOnItemSelectedListener(this); return new AlertDialog.Builder(getContext()) .setTitle(R.string.feedback) .setView(rootView) .setPositiveButton(R.string.text_send, (dialog, which) -> { if (!checkInput()) return; if (onSendClickListener != null) onSendClickListener.onSend(FeedbackDialog.this, feedback); }) .setNegativeButton(R.string.text_cancel, null) .create(); }
Example #16
Source File: MainActivity.java From Anecdote with Apache License 2.0 | 4 votes |
@OnItemSelected(R.id.toolbarSpinner) public void onSpinnerSelected(AppCompatSpinner adapter, View v, int i, long lng) { if (mToolbarSpinnerAdapter.getWebsite() != null) { changeAnecdoteFragment(mToolbarSpinnerAdapter.getWebsite(), mToolbarSpinnerAdapter.getWebsite().pages.get(i)); } }
Example #17
Source File: BaseActivity.java From Studio with Apache License 2.0 | 4 votes |
public SpinnerFilter(AppCompatSpinner spinner, int messageRes) { this.spinner = spinner; this.messageRes = messageRes; }
Example #18
Source File: CreateConnectionFragment.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Context context = getActivity(); final AlertDialog.Builder builder = new AlertDialog.Builder(context); final LayoutInflater dialogInflater = getActivity().getLayoutInflater(); final View view = dialogInflater.inflate(R.layout.dialog_create_connection, null, false); name = (AppCompatEditText) view.findViewById(R.id.name); host = (AppCompatEditText) view.findViewById(R.id.host); port = (AppCompatEditText) view.findViewById(R.id.port); path = (AppCompatEditText) view.findViewById(R.id.path); hostContainer = view.findViewById(R.id.hostContainer); pathContainer = view.findViewById(R.id.pathContainer); username = (AppCompatEditText) view.findViewById(R.id.username); usernameContainer = view.findViewById(R.id.usernameContainer); password = (AppCompatEditText) view.findViewById(R.id.password); passwordContainer = view.findViewById(R.id.passwordContainer); scheme = (AppCompatSpinner) view.findViewById(R.id.scheme); anonymous = (AppCompatCheckBox) view.findViewById(R.id.anonymous); anonymous.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { usernameContainer.setVisibility(b ? View.GONE : View.VISIBLE); passwordContainer.setVisibility(b ? View.GONE : View.VISIBLE); } }); if(connection_id != 0){ NetworkConnection connection = NetworkConnection.fromConnectionId(getActivity(), connection_id); ArrayAdapter myAdap = (ArrayAdapter) scheme.getAdapter(); int spinnerPosition = myAdap.getPosition(connection.getScheme().toUpperCase()); scheme.setSelection(spinnerPosition); name.setText(connection.getName()); host.setText(connection.getHost()); port.setText(Integer.toString(connection.getPort())); path.setText(connection.getPath()); username.setText(connection.getUserName()); password.setText(connection.getPassword()); anonymous.setChecked(connection.isAnonymousLogin()); if(SERVER.equals(connection.getType())){ hostContainer.setVisibility(View.GONE); pathContainer.setVisibility(View.VISIBLE); } } builder.setTitle( (connection_id == 0 ? "New" : "Edit") + " Connection"); builder.setView(view); builder.setPositiveButton(connection_id == 0 ? "ADD" : "SAVE", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final BaseActivity activity = (BaseActivity) getActivity(); NetworkConnection networkConnection = getNetworkConnection(); if(validate(networkConnection)){ new CreateConnectionTask(activity, networkConnection).executeOnExecutor( ProviderExecutor.forAuthority(ExplorerProvider.AUTHORITY)); } } }); builder.setNegativeButton(android.R.string.cancel, null); return builder.create(); }
Example #19
Source File: CreateConnectionFragment.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Context context = getActivity(); final AlertDialog.Builder builder = new AlertDialog.Builder(context); final LayoutInflater dialogInflater = getActivity().getLayoutInflater(); final View view = dialogInflater.inflate(R.layout.dialog_create_connection, null, false); name = (AppCompatEditText) view.findViewById(R.id.name); host = (AppCompatEditText) view.findViewById(R.id.host); port = (AppCompatEditText) view.findViewById(R.id.port); path = (AppCompatEditText) view.findViewById(R.id.path); hostContainer = view.findViewById(R.id.hostContainer); pathContainer = view.findViewById(R.id.pathContainer); username = (AppCompatEditText) view.findViewById(R.id.username); usernameContainer = view.findViewById(R.id.usernameContainer); password = (AppCompatEditText) view.findViewById(R.id.password); passwordContainer = view.findViewById(R.id.passwordContainer); scheme = (AppCompatSpinner) view.findViewById(R.id.scheme); anonymous = (AppCompatCheckBox) view.findViewById(R.id.anonymous); anonymous.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { usernameContainer.setVisibility(b ? View.GONE : View.VISIBLE); passwordContainer.setVisibility(b ? View.GONE : View.VISIBLE); } }); if(connection_id != 0){ NetworkConnection connection = NetworkConnection.fromConnectionId(getActivity(), connection_id); ArrayAdapter myAdap = (ArrayAdapter) scheme.getAdapter(); int spinnerPosition = myAdap.getPosition(connection.getScheme().toUpperCase()); scheme.setSelection(spinnerPosition); name.setText(connection.getName()); host.setText(connection.getHost()); port.setText(Integer.toString(connection.getPort())); path.setText(connection.getPath()); username.setText(connection.getUserName()); password.setText(connection.getPassword()); anonymous.setChecked(connection.isAnonymousLogin()); if(SERVER.equals(connection.getType())){ hostContainer.setVisibility(View.GONE); pathContainer.setVisibility(View.VISIBLE); } } builder.setTitle( (connection_id == 0 ? "New" : "Edit") + " Connection"); builder.setView(view); builder.setPositiveButton(connection_id == 0 ? "ADD" : "SAVE", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final BaseActivity activity = (BaseActivity) getActivity(); NetworkConnection networkConnection = getNetworkConnection(); if(validate(networkConnection)){ new CreateConnectionTask(activity, networkConnection).executeOnExecutor( ProviderExecutor.forAuthority(ExplorerProvider.AUTHORITY)); } } }); builder.setNegativeButton(android.R.string.cancel, null); return builder.create(); }
Example #20
Source File: CreateConnectionFragment.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Context context = getActivity(); final AlertDialog.Builder builder = new AlertDialog.Builder(context); final LayoutInflater dialogInflater = getActivity().getLayoutInflater(); final View view = dialogInflater.inflate(R.layout.dialog_create_connection, null, false); name = (AppCompatEditText) view.findViewById(R.id.name); host = (AppCompatEditText) view.findViewById(R.id.host); port = (AppCompatEditText) view.findViewById(R.id.port); path = (AppCompatEditText) view.findViewById(R.id.path); hostContainer = view.findViewById(R.id.hostContainer); pathContainer = view.findViewById(R.id.pathContainer); username = (AppCompatEditText) view.findViewById(R.id.username); usernameContainer = view.findViewById(R.id.usernameContainer); password = (AppCompatEditText) view.findViewById(R.id.password); passwordContainer = view.findViewById(R.id.passwordContainer); scheme = (AppCompatSpinner) view.findViewById(R.id.scheme); anonymous = (AppCompatCheckBox) view.findViewById(R.id.anonymous); anonymous.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { usernameContainer.setVisibility(b ? View.GONE : View.VISIBLE); passwordContainer.setVisibility(b ? View.GONE : View.VISIBLE); } }); if(connection_id != 0){ NetworkConnection connection = NetworkConnection.fromConnectionId(getActivity(), connection_id); ArrayAdapter myAdap = (ArrayAdapter) scheme.getAdapter(); int spinnerPosition = myAdap.getPosition(connection.getScheme().toUpperCase()); scheme.setSelection(spinnerPosition); name.setText(connection.getName()); host.setText(connection.getHost()); port.setText(Integer.toString(connection.getPort())); path.setText(connection.getPath()); username.setText(connection.getUserName()); password.setText(connection.getPassword()); anonymous.setChecked(connection.isAnonymousLogin()); if(SERVER.equals(connection.getType())){ hostContainer.setVisibility(View.GONE); pathContainer.setVisibility(View.VISIBLE); } } builder.setTitle( (connection_id == 0 ? "New" : "Edit") + " Connection"); builder.setView(view); builder.setPositiveButton(connection_id == 0 ? "ADD" : "SAVE", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final BaseActivity activity = (BaseActivity) getActivity(); NetworkConnection networkConnection = getNetworkConnection(); if(validate(networkConnection)){ new CreateConnectionTask(activity, networkConnection).executeOnExecutor( ProviderExecutor.forAuthority(ExplorerProvider.AUTHORITY)); } } }); builder.setNegativeButton(android.R.string.cancel, null); return builder.create(); }
Example #21
Source File: AppCompatv7DSL.java From anvil with MIT License | 4 votes |
public static BaseDSL.ViewClassResult appCompatSpinner() { return BaseDSL.v(AppCompatSpinner.class); }
Example #22
Source File: AppCompatv7DSL.java From anvil with MIT License | 4 votes |
public static Void appCompatSpinner(Anvil.Renderable r) { return BaseDSL.v(AppCompatSpinner.class, r); }
Example #23
Source File: DataBindingAdapters.java From mobikul-standalone-pos with MIT License | 4 votes |
@InverseBindingAdapter(attribute = "selectedValue", event = "selectedValueAttrChanged") public static String captureSelectedValue(AppCompatSpinner pAppCompatSpinner) { return (String) pAppCompatSpinner.getSelectedItem(); }