androidx.appcompat.widget.AppCompatSpinner Java Examples
The following examples show how to use
androidx.appcompat.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: BindingAdapters.java From lttrs-android with Apache License 2.0 | 6 votes |
@BindingAdapter("identities") public static void setIdentities(final AppCompatSpinner spinner, final List<IdentityWithNameAndEmail> identities) { final List<String> representations; if (identities == null) { representations = Collections.emptyList(); } else { representations = Lists.transform(identities, new Function<IdentityWithNameAndEmail, String>() { @NullableDecl @Override public String apply(IdentityWithNameAndEmail input) { return EmailAddressUtil.toString(input.getEmailAddress()); } }); } final ArrayAdapter<String> adapter = new ArrayAdapter<>( spinner.getContext(), android.R.layout.simple_spinner_item, representations); adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); }
Example #2
Source File: FilterView.java From mimi-reader with Apache License 2.0 | 6 votes |
private void init(Context context) { inflate(context, R.layout.post_filter_view, this); activeBoard = (AppCompatSpinner) findViewById(R.id.active_board); activeBoard.setOnItemSelectedListener(onBoardClicked()); nameInput = (AppCompatEditText) findViewById(R.id.filter_name); filterInput = (AppCompatEditText) findViewById(R.id.filter_text); highlightCheckBox = (AppCompatCheckBox) findViewById(R.id.highlight_checkbox); saveButton = (AppCompatButton) findViewById(R.id.save_button); saveButton.setOnClickListener(this); findViewById(R.id.edit_button).setOnClickListener(this); findViewById(R.id.cancel_button).setOnClickListener(this); }
Example #3
Source File: EditFiltersActivity.java From mimi-reader with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_filter); filterList = (RecyclerView) findViewById(R.id.filter_list); boardSpinner = (AppCompatSpinner) findViewById(R.id.board_spinner); initRecyclerView(); Toolbar toolbar = (Toolbar) findViewById(R.id.mimi_toolbar); toolbar.setNavigationIcon(R.drawable.ic_nav_arrow_back); toolbar.setLogo(null); toolbar.setTitle(R.string.edit_filters); setToolbar(toolbar); String boardName = getIntent().getStringExtra(EXTRA_BOARD_NAME); loadBoards(boardName); }
Example #4
Source File: LiveWallpaperConfigActivity.java From GeometricWeather with GNU Lesser General Public License v3.0 | 5 votes |
public void initView() { Toolbar toolbar = findViewById(R.id.activity_live_wallpaper_config_toolbar); toolbar.setNavigationIcon(R.drawable.ic_toolbar_back); toolbar.setNavigationOnClickListener(view -> finish()); this.container = findViewById(R.id.activity_live_wallpaper_config_container); AppCompatSpinner weatherKindSpinner = findViewById(R.id.activity_live_wallpaper_config_weatherKindSpinner); weatherKindSpinner.setOnItemSelectedListener(new WeatherKindSpinnerSelectedListener()); weatherKindSpinner.setAdapter( new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, weatherKinds) ); weatherKindSpinner.setSelection(Arrays.binarySearch(weatherKindValues, weatherKindValueNow)); AppCompatSpinner dayNightTypeSpinner = findViewById(R.id.activity_live_wallpaper_config_dayNightTypeSpinner); dayNightTypeSpinner.setOnItemSelectedListener(new DayNightTypeSpinnerSelectedListener()); dayNightTypeSpinner.setAdapter( new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, dayNightTypes) ); dayNightTypeSpinner.setSelection(Arrays.binarySearch(dayNightTypeValues, dayNightTypeValueNow)); Button doneButton = findViewById(R.id.activity_live_wallpaper_config_doneButton); doneButton.setOnClickListener(v -> { LiveWallpaperConfigManager.update( this, weatherKindValueNow, dayNightTypeValueNow); finish(); }); }
Example #5
Source File: HolyGraphActivity.java From intra42 with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_holy_graph); cursus = AppSettings.getAppCursus(app); campus = AppSettings.getAppCampus(app); Context context = this; ActionBar bar = getSupportActionBar(); if (bar != null) context = bar.getThemedContext(); SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(context, R.array.spinner_projects_galaxy, android.R.layout.simple_spinner_dropdown_item); spinner = new AppCompatSpinner(this); spinner.getBackground().setColorFilter(Color.parseColor("#ffffff"), PorterDuff.Mode.SRC_ATOP); spinner.setAdapter(spinnerAdapter); spinner.setOnItemSelectedListener(this); Toolbar.LayoutParams lp = new Toolbar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.setMarginStart((int) Tools.dpToPx(context, 8)); spinner.setLayoutParams(lp); if (savedInstanceState != null) spinner.setSelection(savedInstanceState.getInt(STATE_POSITION)); toolbar.addView(spinner); toolbar.setContentInsetStartWithNavigation((int) Tools.dpToPx(context, 8)); listView = findViewById(R.id.listView); listViewAll = findViewById(R.id.listViewAll); textViewNoItem = findViewById(R.id.textViewNoItem); galaxy = findViewById(R.id.galaxy); galaxy.setOnProjectClickListener(this); listView.setOnItemClickListener(this); listViewAll.setOnItemClickListener(this); super.registerGetDataOnOtherThread(this); super.registerGetDataOnMainTread(this); super.setActionBarToggle(ActionBarToggle.HAMBURGER); super.setSelectedMenu(Navigation.MENU_SELECTED_PROJECTS); super.onCreateFinished(); }