当前位置: 首页>>代码示例>>Java>>正文


Java Spinner.setOnItemSelectedListener方法代码示例

本文整理汇总了Java中android.widget.Spinner.setOnItemSelectedListener方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.setOnItemSelectedListener方法的具体用法?Java Spinner.setOnItemSelectedListener怎么用?Java Spinner.setOnItemSelectedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Spinner的用法示例。

在下文中一共展示了Spinner.setOnItemSelectedListener方法的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mRadiogroup = (RadioGroup) findViewById(R.id.radiogroup);

    mImageView = (ImageView) findViewById(R.id.image);
    mImageView.setOnClickListener(this);

    Spinner startScaleTypeSpinner = (Spinner) findViewById(R.id.spinner_start_scaletype);
    Spinner endScaleTypeSpinner = (Spinner) findViewById(R.id.spinner_end_scaletype);

    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, mScaleTypes);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    startScaleTypeSpinner.setAdapter(adapter);
    endScaleTypeSpinner.setAdapter(adapter);

    startScaleTypeSpinner.setOnItemSelectedListener(this);
    endScaleTypeSpinner.setOnItemSelectedListener(this);
}
 
开发者ID:Omega-R,项目名称:OmegaRoundingImageView,代码行数:22,代码来源:MainActivity.java


示例2: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_play_movie_surface);

    mSurfaceView = (SurfaceView) findViewById(R.id.playMovie_surface);
    mSurfaceView.getHolder().addCallback(this);

    // Populate file-selection spinner.
    Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner);
    // Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout
    // for the widget itself.
    mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4");
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, mMovieFiles);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    updateControls();
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:23,代码来源:PlayMovieSurfaceActivity.java


示例3: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_banner_style);
    banner = (Banner) findViewById(R.id.banner);
    spinnerStyle = (Spinner) findViewById(R.id.spinnerStyle);
    spinnerStyle.setOnItemSelectedListener(this);

    //默认是CIRCLE_INDICATOR
    banner.setImages(App.images)
            .setBannerTitles(App.titles)
            .setBannerStyle(BannerConfig.NOT_INDICATOR)
            .setImageLoader(new GlideImageLoader())
            .start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:BannerStyleActivity.java


示例4: setupSpinner

import android.widget.Spinner; //导入方法依赖的package包/类
private void setupSpinner() {
    Spinner spinner = findViewById(R.id.spinner);
    spinner.setOnItemSelectedListener(mMainItemSelected);

    List<String> categories = new ArrayList<>();

    categories.add("All");
    categories.add("Photos");
    categories.add("Videos");


    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(dataAdapter);

    Spinner spinnerFilter = findViewById(R.id.spinnerFilter);
    spinnerFilter.setOnItemSelectedListener(mFilterItemSelected);

    List<String> filter = new ArrayList<>();

    filter.add("CLUSTER BY ALBUM");
    filter.add("CLUSTER BY TIME");
    filter.add("CLUSTER BY LOCATION");
    filter.add("CLUSTER BY TAG");
    filter.add("CLUSTER BY SIZE");
    filter.add("CLUSTER BY FACE");


    ArrayAdapter<String> dataAdapterFilter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, filter);
    dataAdapterFilter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerFilter.setAdapter(dataAdapterFilter);

}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:34,代码来源:AlbumActivity.java


示例5: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unicode);

    // initialize renderer
    renderer = MongolCode.INSTANCE;

    // text views
    tvLabel = (TextView) findViewById(R.id.tvTitle);
    tvResults = (TextView) findViewById(R.id.tvUnicodeResults);

    // set Mongol font
    Typeface tf = MongolFont.get(MongolFont.QAGAN, this);
    //Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/MQG8F02.ttf");
    //Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/MenksoftHawang.ttf");
    tvResults.setTypeface(tf);

    // Chagaan tologai spinner
    List<String> viewChoices = new ArrayList<>(Arrays.asList(names));
    viewChoices.add("MVS");
    viewChoices.add("NNBS");
    viewChoices.add("Other");
    Spinner chagaanTologaiSpinner = (Spinner) findViewById(R.id.spinnerChagaanTolgai);
    ArrayAdapter<String> adapterChagaanTologai = new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_item, viewChoices);
    adapterChagaanTologai.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    chagaanTologaiSpinner.setAdapter(adapterChagaanTologai);
    chagaanTologaiSpinner.setOnItemSelectedListener(this);

    // Font spinner
    List<String> fontChoices = new ArrayList<>(Arrays.asList(fonts));
    Spinner fontSpinner = (Spinner) findViewById(R.id.spinnerFont);
    ArrayAdapter<String> adapterFont = new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_item, fontChoices);
    adapterFont.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    fontSpinner.setAdapter(adapterFont);
    fontSpinner.setOnItemSelectedListener(this);

}
 
开发者ID:suragch,项目名称:mongol-library,代码行数:41,代码来源:UnicodeActivity.java


示例6: updateSpinner

import android.widget.Spinner; //导入方法依赖的package包/类
private void updateSpinner() {
    final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());

    final Spinner localeSpinner =
            (Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale);
    final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<>(
            getActivity(), android.R.layout.simple_spinner_item, localesList);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    localeSpinner.setAdapter(adapter);
    localeSpinner.setOnItemSelectedListener(this);
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:UserDictionaryAddWordFragment.java


示例7: SubtitleDelayPickerDialog

import android.widget.Spinner; //导入方法依赖的package包/类
public SubtitleDelayPickerDialog(Context context, OnDelayChangeListener callBack, int delay, int ratio, boolean hasRatio) {
    super(context);

    getWindow().setGravity(Gravity.TOP);
    getWindow().setBackgroundDrawable(new ColorDrawable(VideoInfoCommonClass.getAlphaColor(ContextCompat.getColor(context, R.color.background_material_dark),128)));
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    mContext = context;
    mCallBack = callBack;

    setIcon(R.drawable.ic_menu_delay);

    LayoutInflater inflater =
            (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.subtitle_delay_picker_dialog, null);
    setView(view);
    mSubtitleDelayPicker = (SubtitleDelayPickerAbstract) view.findViewById(R.id.subtitleDelayPicker);
    mSubtitleDelayPicker.init(delay, this);
    // Setup Spinner
    Spinner sp = (Spinner) view.findViewById(R.id.subtitle_delay_ratio_spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
            mContext, R.array.subtitle_delay_ratio_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sp.setAdapter(adapter);
    sp.setSelection(ratio);
    sp.setOnItemSelectedListener(this);

    updateTitle(delay);

    setCancelable(true);
    setCanceledOnTouchOutside(true);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:33,代码来源:SubtitleDelayPickerDialog.java


示例8: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera_capture);

    File outputFile = new File(getFilesDir(), "camera-test.mp4");
    TextView fileText = (TextView) findViewById(R.id.cameraOutputFile_text);
    fileText.setText(outputFile.toString());

    Spinner spinner = (Spinner) findViewById(R.id.cameraFilter_spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.cameraFilterNames, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    // Define a handler that receives camera-control messages from other threads.  All calls
    // to Camera must be made on the same thread.  Note we create this before the renderer
    // thread, so we know the fully-constructed object will be visible.
    mCameraHandler = new CameraHandler(this);

    mRecordingEnabled = sVideoEncoder.isRecording();

    // Configure the GLSurfaceView.  This will start the Renderer thread, with an
    // appropriate EGL context.
    mGLView = (GLSurfaceView) findViewById(R.id.cameraPreview_surfaceView);
    mGLView.setEGLContextClientVersion(2);     // select GLES 2.0
    mRenderer = new CameraSurfaceRenderer(mCameraHandler, sVideoEncoder, outputFile);
    mGLView.setRenderer(mRenderer);
    mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    Log.d(TAG, "onCreate complete: " + this);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:35,代码来源:CameraCaptureActivity.java


示例9: initViewsDialogEdit

import android.widget.Spinner; //导入方法依赖的package包/类
void initViewsDialogEdit(View v, final Server server, final int serverListPosition) {
    pairingInfoTextView.setVisibility(View.GONE);
    final ServerDatabaseHandler dbHandler = ServerDatabaseHandler.getInstance(getActivity());

    certificateSpinner = (Spinner) v.findViewById(R.id.certificateSpinner);
    List<CertificateSpinnerItem> spinnerList = dbHandler.getSpinnerList();
    ArrayAdapter<CertificateSpinnerItem> spinnerArrayAdapter = new ArrayAdapter<>(
            getActivity().getApplicationContext(),
            R.layout.dialog_certificate_spinner_textview,
            spinnerList);

    spinnerArrayAdapter.setDropDownViewResource(R.layout.dialog_certificate_spinner_dropdown_textview);
    certificateSpinner.setAdapter(spinnerArrayAdapter);
    certificateSpinner.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP);
    certificateSpinner.setOnTouchListener(this);
    certificateSpinner.setOnItemSelectedListener(this);

    for (int i = 0; i < spinnerList.size(); i++){
        if (((CertificateIdAndFingerprint) spinnerList.get(i)).getId() == server.getCertificateId()){
            certificateSpinner.setSelection(i);
        }
    }

    v.findViewById(R.id.deleteServerBtn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dbHandler.deleteServer(server.getId());
            serverAdapterListCallbacks.deleteServer(serverListPosition);
            cancel();
        }
    });

    dbHandler.close();
}
 
开发者ID:rootkiwi,项目名称:an2linuxclient,代码行数:35,代码来源:ServerDialog.java


示例10: onViewCreated

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);
	final Spinner spinnerTimer = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_timer);
	final Spinner spinnerWhen = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_when);
	final Spinner spinnerColors = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_colors);
	final SpinnerLayout spinnerLayoutTimer = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_timer);
	final SpinnerLayout sSpinnerLayoutWhen = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_when);
	final SpinnerLayout spinnerLayoutColors = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors);
	final SpinnerLayout spinnerLayoutColorsDisabled = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors_disabled);

	final Context context = getActivity();
	spinnerTimer.setAdapter(new TimerAdapter(context));
	spinnerTimer.setSelection(2, false);
	spinnerTimer.setOnItemSelectedListener(this);

	spinnerWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN));
	spinnerWhen.setSelection(0, false);
	spinnerWhen.setOnItemSelectedListener(this);

	spinnerColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
	spinnerColors.setSelection(0, false);
	spinnerColors.setOnItemSelectedListener(this);

	spinnerLayoutTimer.setAdapter(new TimerAdapter(context));
	spinnerLayoutTimer.setSelection(2, false);
	spinnerLayoutTimer.setOnItemSelectedListener(this);

	sSpinnerLayoutWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN));
	sSpinnerLayoutWhen.setOnItemSelectedListener(this);

	spinnerLayoutColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
	spinnerLayoutColors.setOnItemSelectedListener(this);

	spinnerLayoutColorsDisabled.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:37,代码来源:MenusFragment.java


示例11: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
 protected void onCreate(Bundle icicle) {
     super.onCreate(icicle);

     // Retrieve the widget id provided by the intent
     mAppWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);


     // Set the Activity result to RESULT_CANCELED immediately : thus the App Widget host will always be notified
     // in case of error or if the user cancels the configuration and the App Widget will not be added
     notifyResult(RESULT_CANCELED);

     if (mAppWidgetId == -1) {
         // Error, no id provided
         finish();
     }

     setContentView(R.layout.widget_configuration);
 
     // Content spinner setup
     Spinner contentSpinner = (Spinner)findViewById(R.id.content_spinner);
     ArrayAdapter<CharSequence> contentAdapter = ArrayAdapter.createFromResource(this, R.array.video_content_array, android.R.layout.simple_spinner_item);
     contentAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
     contentSpinner.setAdapter(contentAdapter);
     contentSpinner.setOnItemSelectedListener(new OnContentItemSelectedListener());

     mValidateButton = (Button)findViewById(R.id.validate_button);
     mValidateButton.setOnClickListener(mValidateButtonClickListener);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:30,代码来源:VideoWidgetConfigure.java


示例12: TimeSpanPicker

import android.widget.Spinner; //导入方法依赖的package包/类
public TimeSpanPicker(Context context, AttributeSet attrs, int defStyle)
{
	super(context, attrs, defStyle);

	this.context = context;

	final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	dialog = inflater.inflate(R.layout.time_span_dialog, this, true);

	timeSpan = new TimeSpan(-1);

	timeSpanEditText = (EditText) dialog.findViewById(R.id.timeSpanEditText);
	timeSpanEditText.setText("0");

	timeSpanSpinner = (Spinner) dialog.findViewById(R.id.timeSpanSpinner);
	timeSpanDisableCheckbox = (CheckBox) dialog.findViewById(R.id.timeSpanDisableCheckBox);

	timeSpanDisableCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
	{
		@Override
		public void onCheckedChanged(CompoundButton compoundButton, boolean b)
		{
			timeSpanEditText.setEnabled(!b);
			timeSpanSpinner.setEnabled(!b);
		}
	});

	adapter = ArrayAdapter.createFromResource(context, R.array.shareExpirationNames, android.R.layout.simple_spinner_item);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	timeSpanSpinner.setAdapter(adapter);

	timeSpanSpinner.setOnItemSelectedListener(this);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:34,代码来源:TimeSpanPicker.java


示例13: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_weather_qbyid);
	spProvince = (Spinner) findViewById(R.id.spProvince);
	spProvince.setOnItemSelectedListener(this);
	spCity = (Spinner) findViewById(R.id.spCity);
	spCity.setOnItemSelectedListener(this);
	spDistrict = (Spinner) findViewById(R.id.spDistrict);
	spDistrict.setOnItemSelectedListener(this);

	// 获取API实例,请求支持预报的城市列表
	Weather api = (Weather) MobAPI.getAPI(Weather.NAME);
	api.getSupportedCities(this);
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:16,代码来源:QueryByCityNameActivity.java


示例14: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_custom_semi_automatic);
	spAPI = (Spinner) findViewById(R.id.spAPI);
	spAPI.setOnItemSelectedListener(this);
	spPath = (Spinner) findViewById(R.id.spPath);
	spPath.setOnItemSelectedListener(this);
	llParams = (LinearLayout) findViewById(R.id.llParams);
	findViewById(R.id.btnSearch).setOnClickListener(this);
	tvJson = (TextView) findViewById(R.id.tvJson);

	getAPIList();
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:14,代码来源:CustomAPISemiAutomaticActivity.java


示例15: initFontFamilySpinner

import android.widget.Spinner; //导入方法依赖的package包/类
private void initFontFamilySpinner(String familyName) {
    Spinner spinner = (Spinner) findViewById(R.id.edit_font_family);
    spinner.setOnItemSelectedListener(this);
    mFontFamilySet = new FontFamilySet();
    mSelectedFontFamily = mFontFamilySet.getFontFamily(familyName);
    mFontFamilyNameList = mFontFamilySet.getFontFamilyDisplayNameList();
    spinner.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_dropdown_item, mFontFamilyNameList));
    spinner.setSelection(mFontFamilyNameList.indexOf(mSelectedFontFamily.displayName));
}
 
开发者ID:olgamiller,项目名称:SSTVEncoder2,代码行数:11,代码来源:EditTextActivity.java


示例16: setUp

import android.widget.Spinner; //导入方法依赖的package包/类
/**
 * This function sets up the dialog with the proper values.  If the speedOff parameters
 * has a -1 value disable both spinners
 *
 * @param color - the color to set
 * @param speedOn - the flash time in ms
 * @param speedOff - the flash length in ms
 */
private void setUp(int color, int speedOn, int speedOff, boolean onOffChangeable) {
    mInflater = (LayoutInflater) getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = mInflater.inflate(R.layout.dialog_light_settings, null);

    mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view);
    mColorPanel = (LinearLayout) layout.findViewById(R.id.color_panel_view);
    mHexColorInput = (EditText) layout.findViewById(R.id.hex_color_input);
    mNewColor = (ColorPanelView) layout.findViewById(R.id.color_panel);
    mLightsDialogDivider = (View) layout.findViewById(R.id.lights_dialog_divider);
    mPulseSpeedOn = (Spinner) layout.findViewById(R.id.on_spinner);
    mPulseSpeedOff = (Spinner) layout.findViewById(R.id.off_spinner);

    mColorPicker.setOnColorChangedListener(this);
    mColorPicker.setColor(color, true);

    mHexColorInput.setOnFocusChangeListener(this);

    if (onOffChangeable) {
        PulseSpeedAdapter pulseSpeedAdapter = new PulseSpeedAdapter(
                R.array.notification_pulse_length_entries,
                R.array.notification_pulse_length_values,
                speedOn);
        mPulseSpeedOn.setAdapter(pulseSpeedAdapter);
        mPulseSpeedOn.setSelection(pulseSpeedAdapter.getTimePosition(speedOn));
        mPulseSpeedOn.setOnItemSelectedListener(mPulseSelectionListener);

        pulseSpeedAdapter = new PulseSpeedAdapter(R.array.notification_pulse_speed_entries,
                R.array.notification_pulse_speed_values,
                speedOff);
        mPulseSpeedOff.setAdapter(pulseSpeedAdapter);
        mPulseSpeedOff.setSelection(pulseSpeedAdapter.getTimePosition(speedOff));
        mPulseSpeedOff.setOnItemSelectedListener(mPulseSelectionListener);
    } else {
        View speedSettingsGroup = layout.findViewById(R.id.speed_title_view);
        speedSettingsGroup.setVisibility(View.GONE);
    }

    mPulseSpeedOn.setEnabled(onOffChangeable);
    mPulseSpeedOff.setEnabled((speedOn != 1) && onOffChangeable);

    setView(layout);
    setTitle(R.string.edit_light_settings);

    if (!getContext().getResources().getBoolean(
            com.android.internal.R.bool.config_multiColorNotificationLed)) {
        mColorPicker.setVisibility(View.GONE);
        mColorPanel.setVisibility(View.GONE);
        mLightsDialogDivider.setVisibility(View.GONE);
    }

    mReadyForLed = true;
    updateLed();
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:63,代码来源:LightSettingsDialog.java


示例17: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_barcode_generate);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    text = (EditText) findViewById(R.id.tfBarcode);
    image = (ImageView) findViewById(R.id.image);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    //Setup the Spinner Menu for the different formats
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    spinner.setOnItemSelectedListener(this);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.barcode_formats_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);


    //If the device were rotated then restore information
    if(savedInstanceState != null){
        text2Barcode = (String) savedInstanceState.get(STATE_TEXT);
        text.setText(text2Barcode);
    }

    // Get intent, action and MINE type and check if the intent was started by a share to modul from an other app
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null){
        if("text/plain".equals(type)){
            handleSendText(intent); //call method to handle sended text
        }
    }

    //OnClickListener for the "+" Button and functionality
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            text2Barcode = text.getText().toString().trim();
            if(text2Barcode.equals("")){
                Toast.makeText(getApplicationContext(), getResources().getText(R.string.error_text_first), Toast.LENGTH_SHORT).show();
            } else {
                multiFormatWriter = new MultiFormatWriter();
                try{
                    BitMatrix bitMatrix = multiFormatWriter.encode(text2Barcode, format, 500,500);
                    BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
                    bitmap = barcodeEncoder.createBitmap(bitMatrix);
                    image.setImageBitmap(bitmap);
                } catch (Exception e){
                    Toast.makeText(activity.getApplicationContext(), getResources().getText(R.string.error_generate), Toast.LENGTH_LONG).show();
                }
            }

        }
    });
}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:60,代码来源:BarcodeGenerateActivity.java


示例18: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    if(Utils.hasLollipop()){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    else if(Utils.hasKitKat()){
        setTheme(R.style.Theme_Document_Translucent);
    }
    setUpStatusBar();
    // Debug.waitForDebugger();
    super.onCreate(icicle);
    mRoots = DocumentsApplication.getRootsCache(this);
    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);
    final Context context = this;
    final Resources res = getResources();
    // Strongly define our horizontal dimension; we leave vertical as
    final WindowManager.LayoutParams a = getWindow().getAttributes();
    final Point size = new Point();
    getWindowManager().getDefaultDisplay().getSize(size);
    // a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
    getWindow().setAttributes(a);
    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        buildDefaultState();
    }
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitleTextAppearance(context,
            android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    mToolbarStack = (Spinner) findViewById(R.id.stack);
    mToolbarStack.setOnItemSelectedListener(mStackListener);
    mRootsToolbar = (Toolbar) findViewById(R.id.roots_toolbar);
    if (mRootsToolbar != null) {
        mRootsToolbar.setTitleTextAppearance(context,
                android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    }
    setSupportActionBar(mToolbar);
    RootsFragment.show(getFragmentManager(), null);
    if (!mState.restored) {
        new RestoreStackTask().execute();
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:47,代码来源:StandaloneActivity.java


示例19: showCertificateChain

import android.widget.Spinner; //导入方法依赖的package包/类
private void showCertificateChain(byte[][] derData) {
    for (int i = 0; i < derData.length; i++) {
        addCertificate(derData[i]);
    }
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(mContext,
            android.R.layout.simple_spinner_item,
            mTitles) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView view = (TextView) super.getView(position, convertView, parent);
            // Add extra padding on the end side to avoid overlapping the dropdown arrow.
            ApiCompatibilityUtils.setPaddingRelative(view, mPadding, mPadding, mPadding * 2,
                    mPadding);
            return view;
        }
    };
    arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    LinearLayout dialogContainer = new LinearLayout(mContext);
    dialogContainer.setOrientation(LinearLayout.VERTICAL);

    TextView title = new TextView(mContext);
    title.setText(R.string.certtitle);
    ApiCompatibilityUtils.setTextAlignment(title, View.TEXT_ALIGNMENT_VIEW_START);
    ApiCompatibilityUtils.setTextAppearance(title, android.R.style.TextAppearance_Large);
    title.setTypeface(title.getTypeface(), Typeface.BOLD);
    title.setPadding(mPadding, mPadding, mPadding, mPadding / 2);
    dialogContainer.addView(title);

    Spinner spinner = new Spinner(mContext);
    ApiCompatibilityUtils.setTextAlignment(spinner, View.TEXT_ALIGNMENT_VIEW_START);
    spinner.setAdapter(arrayAdapter);
    spinner.setOnItemSelectedListener(this);
    spinner.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    // Remove padding so that dropdown has same width as the spinner.
    spinner.setPadding(0, 0, 0, 0);
    dialogContainer.addView(spinner);

    LinearLayout certContainer = new LinearLayout(mContext);
    certContainer.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < mViews.size(); ++i) {
        LinearLayout certificateView = mViews.get(i);
        if (i != 0) {
            certificateView.setVisibility(LinearLayout.GONE);
        }
        certContainer.addView(certificateView);
    }
    ScrollView scrollView = new ScrollView(mContext);
    scrollView.addView(certContainer);
    dialogContainer.addView(scrollView);

    showDialogForView(dialogContainer);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:54,代码来源:CertificateViewer.java



注:本文中的android.widget.Spinner.setOnItemSelectedListener方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。