Java 类android.support.v7.widget.AppCompatSpinner 实例源码
项目:android-validator
文件:PaymentInformationFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_payment_information, container, false);
AppCompatSpinner cardType = (AppCompatSpinner) view.findViewById(R.id.card_type);
TextInputEditText cardNumber = (TextInputEditText) view.findViewById(R.id.card_number);
TextInputEditText expirationDate = (TextInputEditText) view.findViewById(R.id.expiration_date);
TextInputEditText securityCode = (TextInputEditText) view.findViewById(R.id.security_code);
TextView cardTypeError = (TextView) view.findViewById(R.id.card_type_error);
view.findViewById(R.id.submit).setOnClickListener(this);
validator =
new PaymentInformationFormValidator(cardType, cardNumber, expirationDate, securityCode, cardTypeError);
return view;
}
项目:android-validator
文件:AddressFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_address, container, false);
TextInputEditText address = (TextInputEditText) view.findViewById(R.id.address);
TextInputEditText city = (TextInputEditText) view.findViewById(R.id.city);
AppCompatSpinner state = (AppCompatSpinner) view.findViewById(R.id.state);
TextView stateError = (TextView) view.findViewById(R.id.state_error);
TextInputEditText zipCode = (TextInputEditText) view.findViewById(R.id.zip_code);
AppCompatSpinner country = (AppCompatSpinner) view.findViewById(R.id.country);
TextView countryError = (TextView) view.findViewById(R.id.country_error);
view.findViewById(R.id.submit).setOnClickListener(this);
validator = new AddressFormValidator(address, city, state, zipCode, country, stateError, countryError);
return view;
}
项目:jogging-app
文件:ProfileActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Edit Profile");
mFirstName = (EditText) findViewById(R.id.first_name);
mLastName = (EditText) findViewById(R.id.last_name);
mSex = (AppCompatSpinner) findViewById(R.id.sex);
mUnit = (AppCompatSpinner) findViewById(R.id.unit);
mAge = (EditText) findViewById(R.id.age);
user = (User) getIntent().getSerializableExtra(USER);
client = new OkHttpClient();
}
项目:material-toolbar-spinner
文件:MaterialToolbarSpinner.java
private void init() {
setOrientation(HORIZONTAL);
spinner = new AppCompatSpinner(getContext(), null,
R.attr.toolbarSpinnerStyle);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int dropDownVerticalOffset = getResources().getDimensionPixelSize(
R.dimen.popup_dropdown_v_offset_ge_21);
spinner.setDropDownVerticalOffset(dropDownVerticalOffset);
}
addView(spinner, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
}
项目:app-theme-engine
文件:MiscActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_misc);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_back);
toolbar.setTitle(null);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
AppCompatSpinner spinner = (AppCompatSpinner) findViewById(R.id.toolbarSpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.list_item_spinner,
new String[]{"One", "Two", "Three", "Four", "Five", "Six"});
adapter.setDropDownViewResource(R.layout.list_item_spinner_dropdown);
spinner.setAdapter(adapter);
}
项目:Material-In
文件:SampleActivity.java
@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();
}
项目:Material-In
文件:SampleActivity.java
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;
}
项目:4pdaClient-plus
文件:BasePreferencesActivity.java
@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;
}
项目:WeatherDoge
文件:OptionsActivity.java
@Nullable
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
final View result = super.onCreateView(name, context, attrs);
if (result != null) {
return result;
}
// Provide colorized/tinted widgets on non-Material devices
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;
}
项目:Sanxing
文件:SettingsActivity.java
@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;
}
项目:oma-riista-android
文件:SettingsFragment.java
void setupLanguageSelect(final Context context, final View view) {
AppCompatSpinner spinner = (AppCompatSpinner) view.findViewById(R.id.languageSpinner);
List<String> selections = new ArrayList<>();
selections.add(getResources().getString(R.string.Finnish));
selections.add(getResources().getString(R.string.Swedish));
selections.add(getResources().getString(R.string.English));
ArrayAdapter<String> adapter = new ArrayAdapter<>(this.getActivity(), R.layout.setting_spinner_item, selections);
adapter.setDropDownViewResource(R.layout.setting_spinner_dropdown_item);
spinner.setAdapter(adapter);
String languageSetting = AppPreferences.getLanguageCodeSetting(context);
switch (languageSetting) {
case AppPreferences.LANGUAGE_CODE_FI:
spinner.setSelection(0);
break;
case AppPreferences.LANGUAGE_CODE_SV:
spinner.setSelection(1);
break;
default: // "en"
spinner.setSelection(2);
break;
}
spinner.setOnItemSelectedListener(new LanguageSelectedListener(context));
}
项目:oma-riista-android
文件:ChoiceView.java
public ChoiceView(Context context, String titleText) {
super(context);
LayoutInflater.from(context).inflate(R.layout.view_choice, this);
((TextView) findViewById(R.id.txt_choice_title)).setText(titleText);
mSpinner = (AppCompatSpinner) findViewById(R.id.spinner_choice);
mCheckBox = (AppCompatCheckBox) findViewById(R.id.check_choice);
mEditText = (EditText) findViewById(R.id.edit_text_choice);
mCheckBoxes = (LinearLayout) findViewById(R.id.container_check_boxes);
mBottomSeparator = findViewById(R.id.separator_choice_bottom);
}
项目:android-validator
文件:PaymentInformationFormValidator.java
public PaymentInformationFormValidator(AppCompatSpinner cardType, TextInputEditText cardNumber,
TextInputEditText expirationDate, TextInputEditText securityCode, TextView cardTypeError) {
this.cardNumber = cardNumber;
this.expirationDate = expirationDate;
this.securityCode = securityCode;
this.cardTypeError = cardTypeError;
add(new NotEqualsConstraint(cardType, "Card type", PROPERTY_CARD_TYPE));
add(new NotBlankConstraint(cardNumber, PROPERTY_CARD_NUMBER));
add(new NotBlankConstraint(expirationDate, PROPERTY_EXPIRATION_DATE));
add(new NotBlankConstraint(securityCode, PROPERTY_SECURITY_CODE));
}
项目:android-validator
文件:AddressFormValidator.java
public AddressFormValidator(TextInputEditText address, TextInputEditText city, AppCompatSpinner state,
TextInputEditText zipCode, AppCompatSpinner country, TextView stateError, TextView countryError) {
this.address = address;
this.city = city;
this.zipCode = zipCode;
this.stateError = stateError;
this.countryError = countryError;
add(new NotBlankConstraint(address, PROPERTY_ADDRESS));
add(new NotBlankConstraint(city, PROPERTY_CITY));
add(new NotEqualsConstraint(state, "State", PROPERTY_STATE));
add(new NotBlankConstraint(zipCode, PROPERTY_ZIP_CODE));
add(new NotEqualsConstraint(country, "Country", PROPERTY_COUNTRY));
}
项目:Liapp
文件:SettingsActivity.java
@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;
}
项目:android-animated-vectors
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mImage = (AppCompatImageView) findViewById(R.id.image);
mButton = (AppCompatButton) findViewById(R.id.button);
mSpinner = (AppCompatSpinner) findViewById(R.id.spinner);
setLightStatusBar(findViewById(R.id.activity_main));
mCurrentType = ANIM_FADE_SCALE;
setupButton();
setupSpinner();
instantiateAnimatedVectorDrawables();
}
项目:GeometricWeather
文件:CreateWidgetDayWeekActivity.java
@Override
public void initWidget() {
setWidgetView(true);
ImageView wallpaper = findViewById(R.id.activity_create_widget_day_week_wall);
wallpaper.setImageDrawable(WallpaperManager.getInstance(this).getDrawable());
this.container = findViewById(R.id.activity_create_widget_day_week_container);
AppCompatSpinner viewTypeSpinner = findViewById(R.id.activity_create_widget_day_week_styleSpinner);
viewTypeSpinner.setOnItemSelectedListener(new ViewTypeSpinnerSelectedListener());
viewTypeSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, viewTypes));
this.showCardSwitch = findViewById(R.id.activity_create_widget_day_week_showCardSwitch);
showCardSwitch.setOnCheckedChangeListener(new ShowCardSwitchCheckListener());
this.hideSubtitleSwitch = findViewById(R.id.activity_create_widget_day_week_hideSubtitleSwitch);
hideSubtitleSwitch.setOnCheckedChangeListener(new HideRefreshTimeSwitchCheckListener());
AppCompatSpinner subtitleDataSpinner = findViewById(R.id.activity_create_widget_day_week_subtitleDataSpinner);
subtitleDataSpinner.setOnItemSelectedListener(new SubtitleDataSpinnerSelectedListener());
subtitleDataSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, subtitleData));
this.blackTextSwitch = findViewById(R.id.activity_create_widget_day_week_blackTextSwitch);
blackTextSwitch.setOnCheckedChangeListener(new BlackTextSwitchCheckListener());
Button doneButton = findViewById(R.id.activity_create_widget_day_week_doneButton);
doneButton.setOnClickListener(this);
}
项目:GeometricWeather
文件:CreateWidgetClockDayVerticalActivity.java
@Override
public void initWidget() {
setWidgetView(true);
ImageView wallpaper = findViewById(R.id.activity_create_widget_clock_day_vertical_wall);
wallpaper.setImageDrawable(WallpaperManager.getInstance(this).getDrawable());
this.container = findViewById(R.id.activity_create_widget_clock_day_vertical_container);
AppCompatSpinner viewTypeSpinner = findViewById(R.id.activity_create_widget_clock_day_vertical_styleSpinner);
viewTypeSpinner.setOnItemSelectedListener(new ViewTypeSpinnerSelectedListener());
viewTypeSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, viewTypes));
this.showCardSwitch = findViewById(R.id.activity_create_widget_clock_day_vertical_showCardSwitch);
showCardSwitch.setOnCheckedChangeListener(new ShowCardSwitchCheckListener());
this.hideSubtitleSwitch = findViewById(R.id.activity_create_widget_clock_day_vertical_hideSubtitleSwitch);
hideSubtitleSwitch.setOnCheckedChangeListener(new HideSubtitleSwitchCheckListener());
AppCompatSpinner subtitleDataSpinner = findViewById(R.id.activity_create_widget_clock_day_vertical_subtitleDataSpinner);
subtitleDataSpinner.setOnItemSelectedListener(new SubtitleDataSpinnerSelectedListener());
subtitleDataSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, subtitleData));
this.blackTextSwitch = findViewById(R.id.activity_create_widget_clock_day_vertical_blackTextSwitch);
blackTextSwitch.setOnCheckedChangeListener(new BlackTextSwitchCheckListener());
Button doneButton = findViewById(R.id.activity_create_widget_clock_day_vertical_doneButton);
doneButton.setOnClickListener(this);
}
项目:GeometricWeather
文件:CreateWidgetDayActivity.java
@Override
public void initWidget() {
setWidgetView(true);
ImageView wallpaper = findViewById(R.id.activity_create_widget_day_wall);
wallpaper.setImageDrawable(WallpaperManager.getInstance(this).getDrawable());
this.container = findViewById(R.id.activity_create_widget_day_container);
AppCompatSpinner viewTypeSpinner = findViewById(R.id.activity_create_widget_day_styleSpinner);
viewTypeSpinner.setOnItemSelectedListener(new ViewTypeSpinnerSelectedListener());
viewTypeSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, viewTypes));
this.showCardSwitch = findViewById(R.id.activity_create_widget_day_showCardSwitch);
showCardSwitch.setOnCheckedChangeListener(new ShowCardSwitchCheckListener());
this.hideSubtitleSwitch = findViewById(R.id.activity_create_widget_day_hideSubtitleSwitch);
hideSubtitleSwitch.setOnCheckedChangeListener(new HideRefreshTimeSwitchCheckListener());
AppCompatSpinner subtitleDataSpinner = findViewById(R.id.activity_create_widget_day_subtitleDataSpinner);
subtitleDataSpinner.setOnItemSelectedListener(new SubtitleDataSpinnerSelectedListener());
subtitleDataSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, subtitleData));
this.blackTextSwitch = findViewById(R.id.activity_create_widget_day_blackTextSwitch);
blackTextSwitch.setOnCheckedChangeListener(new BlackTextSwitchCheckListener());
Button doneButton = findViewById(R.id.activity_create_widget_day_doneButton);
doneButton.setOnClickListener(this);
}
项目:Puff-Android
文件:SelectorItem.java
@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);
}
项目:Android-Arduino
文件:SensorFormActivity.java
@Override
protected void populateElementsFromLayout() {
editName = (EditText) findViewById(R.id.name);
editArduino = (AppCompatSpinner) findViewById(R.id.arduino);
editArduino.setAdapter(new ArrayAdapter<>(this,
android.R.layout.simple_spinner_item, getArduinoLists()));
editType = (RadioGroup) findViewById(R.id.type);
editTypeDigital = (RadioButton) findViewById(R.id.type_digital);
editTypeAnalogical = (RadioButton) findViewById(R.id.type_analogical);
editDirection = (RadioGroup) findViewById(R.id.direction);
editDirectionInput = (RadioButton) findViewById(R.id.direction_input);
editDirectionOutput = (RadioButton) findViewById(R.id.direction_output);
editPort = (EditText) findViewById(R.id.port);
}
项目:Snapmatic-Life
文件:SettingsActivity.java
@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;
}
项目:365browser
文件:DownloadManagerToolbar.java
/**
* 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);
}
项目:Android-Carbon-Forum
文件:AppCompatPreferenceActivity.java
@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;
}
项目:CodeColors
文件:AppCompatDefStyleHandler.java
@SuppressLint({"PrivateResource", "InlinedApi"})
@Override
protected int getDefaultViewDefStyleAttr(View view) {
if (view instanceof AppCompatRadioButton) {
return R.attr.radioButtonStyle;
} else if (view instanceof AppCompatCheckBox) {
return R.attr.checkboxStyle;
} else if (view instanceof AppCompatButton) {
return R.attr.buttonStyle;
} else if (view instanceof AppCompatMultiAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatEditText) {
return R.attr.editTextStyle;
} else if (view instanceof AppCompatCheckedTextView) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
android.R.attr.checkedTextViewStyle : 0;
} else if (view instanceof AppCompatTextView) {
return android.R.attr.textViewStyle;
} else if (view instanceof AppCompatSpinner) {
return R.attr.spinnerStyle;
} else if (view instanceof AppCompatImageButton) {
return R.attr.imageButtonStyle;
} else if (view instanceof AppCompatRatingBar) {
return R.attr.ratingBarStyle;
} else if (view instanceof AppCompatSeekBar) {
return R.attr.seekBarStyle;
} else {
return super.getDefaultViewDefStyleAttr(view);
}
}
项目:Hentoid
文件:PrefsActivity.java
@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);
default: // do nothing
break;
}
}
return null;
}
项目:MyCTFWriteUps
文件:ScrollingTabContainerView.java
private Spinner createSpinner()
{
AppCompatSpinner appcompatspinner = new AppCompatSpinner(getContext(), null, android.support.v7.appcompat.R.attr.actionDropDownStyle);
appcompatspinner.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2, -1));
appcompatspinner.setOnItemSelectedListener(this);
return appcompatspinner;
}
项目:dhis2-android-datacapture
文件:DataEntryActivity.java
private void setupFormSpinner() {
formGroupSpinner = (AppCompatSpinner) findViewById(R.id.spinner_drop_down);
if (formGroupSpinner != null) {
formGroupSpinner.setVisibility(View.GONE);
}
}
项目:SampleAppArch
文件:SpinnerBindingUtil.java
@InverseBindingAdapter(attribute = "selectedValue", event = "selectedValueAttrChanged")
public static String captureSelectedValue(AppCompatSpinner pAppCompatSpinner) {
return (String) pAppCompatSpinner.getSelectedItem();
}
项目:ScanLinks
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getSupportActionBar() != null) {
getSupportActionBar().setElevation(0.0f);
}
new Prefs.Builder()
.setContext(this)
.setMode(ContextWrapper.MODE_PRIVATE)
.setPrefsName(getPackageName())
.setUseDefaultSharedPreference(true)
.build();
if (Prefs.getBoolean("firstRun", true)) {
showFirstRunDialog();
}
if (!Prefs.getBoolean("firstRun", true)) {
if (!checkIfDefault()) {
showNotDefaultBrowserDialog();
}
}
spinner = (AppCompatSpinner) findViewById(R.id.spinner1);
radioButton1 = (AppCompatRadioButton) findViewById(R.id.radioButton1);
radioButton2 = (AppCompatRadioButton) findViewById(R.id.radioButton2);
radioButton3 = (AppCompatRadioButton) findViewById(R.id.radioButton3);
checkBox1 = (AppCompatCheckBox)findViewById(R.id.checkBox1);
button = (AppCompatButton)findViewById(R.id.button2);
spinnerArray = new ArrayList<>();
loadPreferences();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
savePreferences();
}
});
}
项目:easyfilemanager
文件:CreateConnectionFragment.java
@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();
}
项目:FireFiles
文件:CreateConnectionFragment.java
@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();
}
项目:OCast-Java
文件:ViewModel.java
@InverseBindingAdapter(attribute = "selectedItemPosition")
public Integer getSelectedItemPosition(AppCompatSpinner spinner)
{
return spinner.getSelectedItemPosition();
}
项目:OCast-Java
文件:ViewModel.java
@BindingAdapter("selectedItemPosition")
public void setSelectedItemPosition(AppCompatSpinner spinner,int position)
{
if(spinner.getSelectedItemPosition()!=position)
spinner.setSelection(position);
}
项目:simple-share-android
文件:CreateConnectionFragment.java
@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();
}
项目:Anecdote
文件:MainActivity.java
@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));
}
}
项目:Groover
文件:RankingListFragment.java
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
RankingDataUseCase useCase = new RankingDataUseCase();
loadingLayout.setVisibility(View.VISIBLE);
// どのデータが表示されたかを解決し、UseCaseにgetする
switch (this.TYPE) {
case 0:
//Level
switch (position) {
case 0:
useCase.getRankingData(SPConst.LEVEL_ALL_RANKING);
break;
case 1:
useCase.getRankingData(SPConst.LEVEL_SIMPLE_RANKING);
break;
case 2:
useCase.getRankingData(SPConst.LEVEL_NORMAL_RANKING);
break;
case 3:
useCase.getRankingData(SPConst.LEVEL_HARD_RANKING);
break;
case 4:
useCase.getRankingData(SPConst.LEVEL_EXTRA_RANKING);
break;
}
break;
case 1:
// Genre
AppCompatSpinner spinner = (AppCompatSpinner) parent;
switch (spinner.getSelectedItem().toString()) {
case Const.RANKING_GENRE_JPOP:
// Genreのgetメソッドの実装
useCase.getRankingData(SPConst.GENRE_JPOP_RANKING);
break;
case Const.RANKING_GENRE_ANIME:
useCase.getRankingData(SPConst.GENRE_ANIME_RANKING);
break;
case Const.RANKING_GENRE_VOCALOID:
useCase.getRankingData(SPConst.GENRE_VOCALOID_RANKING);
break;
case Const.RANKING_GENRE_TOHO:
useCase.getRankingData(SPConst.GENRE_TOUHOU_RANKING);
break;
case Const.RANKING_GENRE_GAME:
useCase.getRankingData(SPConst.GENRE_GAME_RANKING);
break;
case Const.RANKING_GENRE_VARIETY:
useCase.getRankingData(SPConst.GENRE_VARIETY_RANKING);
break;
case Const.RANKING_GENRE_ORIGINAL:
useCase.getRankingData(SPConst.GENRE_ORIGINAL_RANKING);
break;
}
break;
case 2:
// Event
useCase.getEventRankingData(position);
break;
default:
break;
}
}
项目:SchulinfoApp-android
文件:SubstListAdapter.java
public SpinnerHeaderViewHolder(View itemView, SubstPagerFragment frag) {
super(itemView);
this.frag = frag;
spinner = (AppCompatSpinner) itemView.findViewById(R.id.spinner);
}