android.widget.Spinner Java Examples

The following examples show how to use android.widget.Spinner. 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: SingleSelectCategory.java    From FTCLibrary with MIT License 6 votes vote down vote up
/**
 * @inheritDoc Constructs an Spinner object, using an ArrayAdapter to set the spinner options
 * provided
 */
@Override
public View getView(Context context) {
    //Generate ID
    id = ID_OFFSET + new Random().nextInt(100);
    //Create row
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout row = new LinearLayout(context);
    row.setOrientation(LinearLayout.HORIZONTAL);
    //Create TextView
    TextView t = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, null);
    t.setText(name);
    row.addView(t);
    //Create Spinner
    Spinner spinner = new Spinner(context);
    spinner.setId(id);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item, options);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    row.addView(spinner);
    view = row;
    return row;
}
 
Example #2
Source File: StatisticsCache.java    From privacy-friendly-shopping-list with Apache License 2.0 6 votes vote down vote up
public StatisticsCache(AppCompatActivity activity)
{
    this.activity = activity;

    titleTextView = (TextView) activity.findViewById(R.id.textview_stats_title);
    chart = (BarChart) activity.findViewById(R.id.chart);
    totalTextView = (TextView) activity.findViewById(R.id.textview_stats_total);

    unitsTextView = (TextView) activity.findViewById(R.id.textview_stats_currency);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String defaultCurrency = activity.getResources().getString(R.string.currency);
    currency = prefs.getString(SettingsKeys.CURRENCY, defaultCurrency);
    unitsTextView.setText(currency);

    rangeFromTextView = (TextView) activity.findViewById(R.id.textview_stats_range_from);
    rangeToTextView = (TextView) activity.findViewById(R.id.textview_stats_range_to);
    groupBySpinner = (Spinner) activity.findViewById(R.id.spinner_stats_group_by);
    valuesSpinner = (Spinner) activity.findViewById(R.id.spinner_stats_values);

    datePattern = activity.getResources().getString(R.string.date_short_pattern);
    dateLanguage = activity.getResources().getString(R.string.language);
    numberFormat = activity.getResources().getString(R.string.number_format_2_decimals);
}
 
Example #3
Source File: MainActivity.java    From aedict with GNU General Public License v3.0 6 votes vote down vote up
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
	final Activity activity = MainActivity.this;
	final Spinner matcher = (Spinner) activity.findViewById(R.id.matcher);
	final CheckBox deinflect = (CheckBox) activity.findViewById(R.id.jpDeinflectVerbs);
	final CheckBox tanaka = (CheckBox) activity.findViewById(R.id.searchExamples);
	final CheckBox translate = (CheckBox) activity.findViewById(R.id.translate);
	if (buttonView.getId() == R.id.jpDeinflectVerbs && isChecked) {
		matcher.setSelection(MatcherEnum.Exact.ordinal());
		tanaka.setChecked(false);
		translate.setChecked(false);
	} else if (buttonView.getId() == R.id.searchExamples && isChecked) {
		matcher.setSelection(MatcherEnum.Substring.ordinal());
		deinflect.setChecked(false);
		translate.setChecked(false);
	} else if (buttonView.getId() == R.id.translate && isChecked) {
		deinflect.setChecked(false);
		tanaka.setChecked(false);
	}
	matcher.setEnabled(!deinflect.isChecked() && !tanaka.isChecked() && !translate.isChecked());
	findViewById(R.id.englishSearch).setEnabled(!translate.isChecked() && !deinflect.isChecked());
}
 
Example #4
Source File: DropdownView.java    From Dashchan with Apache License 2.0 6 votes vote down vote up
public DropdownView(Context context, AttributeSet attrs) {
	super(context, attrs);
	spinner = new Spinner(context);
	spinner.setId(android.R.id.edit);
	spinner.setPadding(0, 0, 0, 0);
	addView(spinner, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	LayoutParams layoutParams = (LayoutParams) spinner.getLayoutParams();
	if (C.API_LOLLIPOP) {
		layoutParams.gravity = Gravity.CENTER_VERTICAL;
		setBackgroundResource(ResourceUtils.getResourceId(context, android.R.attr.editTextBackground, 0));
		setAddStatesFromChildren(true);
	} else {
		float density = ResourceUtils.obtainDensity(context);
		layoutParams.setMargins(0, (int) (4f * density), 0, (int) (4f * density));
	}
}
 
Example #5
Source File: DetailActivity.java    From KinoCast with MIT License 6 votes vote down vote up
private void setMirrorSpinner(Host mirrors[]) {
    if (mirrors != null && mirrors.length > 0) {
        Arrays.sort(mirrors, new WeightedHostComparator(Utils.getWeightedHostList(getApplicationContext())));
        ((Spinner) findViewById(R.id.spinnerMirror)).setAdapter(
                new ArrayAdapter<>(DetailActivity.this, android.R.layout.simple_list_item_1,
                        mirrors));
        findViewById(R.id.spinnerMirror).setEnabled(true);
        findViewById(R.id.buttonPlay).setEnabled(true);
    } else {
        ((Spinner) findViewById(R.id.spinnerMirror)).setAdapter(
                new ArrayAdapter<>(DetailActivity.this, android.R.layout.simple_list_item_1,
                        new String[]{getString(R.string.no_host_found)}));
        findViewById(R.id.spinnerMirror).setEnabled(false);
        findViewById(R.id.buttonPlay).setEnabled(false);
    }
    findViewById(R.id.layoutMirror).setVisibility(View.VISIBLE);
}
 
Example #6
Source File: AddServerActivity.java    From Atomic with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Populate a server object from the data in the view
 *
 * @return The server object
 */
private Server getServerFromView() {
  String title = ((EditText)findViewById(R.id.title)).getText().toString().trim();
  String host = ((EditText)findViewById(R.id.host)).getText().toString().trim();
  int port = Integer.parseInt(((EditText)findViewById(R.id.port)).getText().toString().trim());
  String password = ((EditText)findViewById(R.id.password)).getText().toString().trim();
  String charset = ((Spinner)findViewById(R.id.charset)).getSelectedItem().toString();
  Boolean useSSL = ((CheckBox)findViewById(R.id.useSSL)).isChecked();
  Boolean autoConnect = ((CheckBox)findViewById(R.id.autoconnect)).isChecked();

  Server server = new Server();
  server.setHost(host);
  server.setPort(port);
  server.setPassword(password);
  server.setTitle(title);
  server.setCharset(charset);
  server.setUseSSL(useSSL);
  server.setAutoconnect(autoConnect);
  server.setStatus(Status.DISCONNECTED);

  return server;
}
 
Example #7
Source File: AddressToPostcodeActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_postcode_a2p);
	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);
	spAddress = (Spinner) findViewById(R.id.spAddress);
	spAddress.setOnItemSelectedListener(this);
	tvPostcode = (TextView) findViewById(R.id.tvPostcode);

	// 获取API,请求城市列表
	Postcode api = (Postcode) MobAPI.getAPI(Postcode.NAME);
	api.listAddress(this);
}
 
Example #8
Source File: MainActivity.java    From DroneKit-Android-Starter with Apache License 2.0 6 votes vote down vote up
public void onBtnConnectTap(View view) {
    if (this.drone.isConnected()) {
        this.drone.disconnect();
    } else {
        Spinner connectionSelector = (Spinner) findViewById(R.id.selectConnectionType);
        int selectedConnectionType = connectionSelector.getSelectedItemPosition();

        Bundle extraParams = new Bundle();
        if (selectedConnectionType == ConnectionType.TYPE_USB) {
            extraParams.putInt(ConnectionType.EXTRA_USB_BAUD_RATE, DEFAULT_USB_BAUD_RATE); // Set default baud rate to 57600
        } else {
            extraParams.putInt(ConnectionType.EXTRA_UDP_SERVER_PORT, DEFAULT_UDP_PORT); // Set default baud rate to 14550
        }

        ConnectionParameter connectionParams = new ConnectionParameter(selectedConnectionType, extraParams, null);
        this.drone.connect(connectionParams);
    }

}
 
Example #9
Source File: ConfigureStandupTimer.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
public void onClick(View v) {
    Intent i = new Intent(this, StandupTimer.class);

    meetingLength = getMeetingLengthFromUI();
    i.putExtra("meetingLength", meetingLength);

    TextView t = (TextView) findViewById(R.id.num_participants);
    numParticipants = parseNumberOfParticipants(t);
    i.putExtra("numParticipants", numParticipants);

    Spinner teamNameSpinner = (Spinner) findViewById(R.id.team_names);
    teamNamesPos = teamNameSpinner.getSelectedItemPosition();
    i.putExtra("teamName", (String) teamNameSpinner.getSelectedItem());

    if (numParticipants < 1 || (Prefs.allowUnlimitedParticipants(this) == false && numParticipants > 20)) {
        showInvalidNumberOfParticipantsDialog();
    } else {
        saveState();
        startTimer(i);
    }
}
 
Example #10
Source File: PlayMovieActivity.java    From grafika with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_play_movie);

    mTextureView = (TextureView) findViewById(R.id.movie_texture_view);
    mTextureView.setSurfaceTextureListener(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();
}
 
Example #11
Source File: KeyBindingsDialog.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View getChildView(final int groupPosition, final int childPosition, final boolean isLastChild,
        View convertView, final ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.keybinding_action, parent, false);
    }

    final KeyAction action = getChild(groupPosition, childPosition);

    final TextView keyView = (TextView) convertView.findViewById(R.id.keybinding_key);
    keyView.setText(action.label);

    final Spinner actionsView = (Spinner) convertView.findViewById(R.id.keybinding_actions);
    actionsView.setOnItemSelectedListener(this);
    actionsView.setAdapter(actionsAdapter);
    actionsView.setTag(action);
    updateAction(actionsView);

    return convertView;
}
 
Example #12
Source File: CountActivity.java    From accountBook with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化spinner
 */
private void initSpinner(){
    month_spinner = (Spinner) findViewById(R.id.month_spinner);
    //将可选内容与ArrayAdapter连接起来
    month_adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, monthList);
    //设置下拉列表的风格
    month_adapter
            .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    //将adapter添加到spinner中
    month_spinner.setAdapter(month_adapter);
    //添加事件Spinner事件监听
    month_spinner
            .setOnItemSelectedListener(new month_spinnerSelectedListener());
    //设置默认值
    month_spinner.setSelection(pubFun.getTime("M"), true);
    month_spinner.setVisibility(View.VISIBLE);
}
 
Example #13
Source File: TrainingActivity.java    From BotLibre with Eclipse Public License 1.0 6 votes vote down vote up
public void browse() {
	ResponseConfig response = getSelectedResponse();
	if (response == null) {
		MainActivity.error("Select a response browse", null, this);
       	return;
	}
	ResponseSearchConfig config = new ResponseSearchConfig();
	config.instance = this.instance.id;
	config.responseType = "responses";
	config.duration = "all";
	config.inputType = "all";
	config.restrict = "exact";
	config.filter = response.response;

	this.first = true;
	Spinner spin = (Spinner) findViewById(R.id.responseTypeSpin);
	spin.setSelection(Arrays.asList(MainActivity.responseTypes).indexOf("responses"));
	this.responses = new ArrayList<ResponseConfig>();
	
    HttpAction action = new HttpGetResponsesAction(this, config);
	action.execute();
}
 
Example #14
Source File: EnterPhoneNumberFragment.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private void initializeSpinner(Spinner countrySpinner) {
  countrySpinnerAdapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_spinner_item);
  countrySpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

  setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));

  countrySpinner.setAdapter(countrySpinnerAdapter);
  countrySpinner.setOnTouchListener((view, event) -> {
    if (event.getAction() == MotionEvent.ACTION_UP) {
      pickCountry(view);
    }
    return true;
  });
  countrySpinner.setOnKeyListener((view, keyCode, event) -> {
    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER && event.getAction() == KeyEvent.ACTION_UP) {
      pickCountry(view);
      return true;
    }
    return false;
  });
}
 
Example #15
Source File: UserMeasurementView.java    From openScale with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected View getInputView() {
    Spinner spinScaleUer = new Spinner(getContext());
    ArrayAdapter<String> spinScaleUserAdapter = new ArrayAdapter<>(getContext(), R.layout.support_simple_spinner_dropdown_item, new ArrayList<>());

    spinScaleUer.setAdapter(spinScaleUserAdapter);

    int spinPos = 0;

    for (ScaleUser scaleUser : openScale.getScaleUserList()) {
        spinScaleUserAdapter.add(scaleUser.getUserName());

        if (scaleUser.getId() == userId) {
            spinPos = spinScaleUserAdapter.getCount() - 1;
        }
    }

    spinScaleUer.setSelection(spinPos);

    return spinScaleUer;
}
 
Example #16
Source File: EncodingConfigFragment.java    From PLDroidMediaStreaming with Apache License 2.0 6 votes vote down vote up
private void initVideoQualityPanel(final View root) {
    final Spinner presetSpinner = (Spinner) root.findViewById(R.id.video_quality_presets);
    ArrayAdapter<String> data = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, VIDEO_QUALITY_PRESETS);
    presetSpinner.setAdapter(data);
    presetSpinner.setSelection(4);

    Spinner profileSpinner = (Spinner) root.findViewById(R.id.video_quality_custom_profile);
    data = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, VIDEO_QUALITY_PROFILES);
    profileSpinner.setAdapter(data);
    profileSpinner.setSelection(0);

    RadioGroup videoRadioGroup = (RadioGroup) root.findViewById(R.id.video_quality_radio_group);
    videoRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            View customPanel = root.findViewById(R.id.video_quality_custom_panel);
            presetSpinner.setVisibility(checkedId == R.id.video_quality_preset ? View.VISIBLE : View.GONE);
            customPanel.setVisibility(checkedId == R.id.video_quality_preset ? View.GONE : View.VISIBLE);
        }
    });
}
 
Example #17
Source File: RecurActivity.java    From financisto with GNU General Public License v2.0 5 votes vote down vote up
private void addSpinnerItems(Spinner spinner, LocalizableEnum[] a) {
    int length = a.length;
    SpinnerItem[] items = new SpinnerItem[length];
    for (int i = 0; i < length; i++) {
        LocalizableEnum x = a[i];
        String title = getString(x.getTitleId());
        String value = x.name();
        items[i] = new SpinnerItem(title, value);
    }
    ArrayAdapter<SpinnerItem> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, items);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
}
 
Example #18
Source File: PlaceSpinner.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
private void select(Spinner spin, ArrayAdapter<CharSequence> adapter, int arry)
{
	adapter = ArrayAdapter.createFromResource(context, arry, android.R.layout.simple_spinner_item);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spin.setAdapter(adapter);
	//spin.setSelection(0,true);
}
 
Example #19
Source File: UnicodeActivity.java    From mongol-library with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unicode);

    // initialize renderer
    renderer = MongolCode.INSTANCE;

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

    // set Mongol font
    Typeface tf = MongolFont.get(MongolFont.QAGAN, this);
    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 = 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 = 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);

}
 
Example #20
Source File: ConditionEventSkillViewFragment.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.skill_event__condition_event, container, false);
    sw_condition = new DataSelectSpinnerWrapper(Objects.requireNonNull(getContext()), (Spinner) view.findViewById(R.id.spinner_condition));
    sw_condition
            .beginInit()
            .setAllowEmpty(false)
            .fillData(new ConditionDataStorage(getContext()).list())
            .finalizeInit();
    rg_condition_event = view.findViewById(R.id.rg_condition_event);
    return view;
}
 
Example #21
Source File: TrainingActivity.java    From BotLibre with Eclipse Public License 1.0 5 votes vote down vote up
public ResponseConfig getSelectedResponse() {
	Spinner spin = (Spinner) findViewById(R.id.responseTypeSpin);
	String type = (String)spin.getSelectedItem();
       ListView list = (ListView) findViewById(R.id.responseList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		return null;
	}
	
	if (type.equals("conversations")) {
		Object selected = this.conversationInput.get(index);
		if (selected instanceof ConversationConfig) {
			return null;
		} else {
			ResponseConfig response = new ResponseConfig();
			response.response = ((InputConfig)selected).value;
			if (index > 1) {
				Object previous = this.conversationInput.get(index - 1);
				if (previous instanceof InputConfig) {
					response.question = ((InputConfig)previous).value;
				}
			}
			return response;
		}
	} else {
		return this.responses.get(index);
	}
}
 
Example #22
Source File: PagerActivity.java    From UltraViewPager with MIT License 5 votes vote down vote up
private void initUI() {
    indicatorStyle = (Spinner) findViewById(R.id.indicator);
    indicatorGravityHor = (Spinner) findViewById(R.id.indicator_gravity_hor);
    indicatorGravityVer = (Spinner) findViewById(R.id.indicator_gravity_ver);

    ArrayAdapter<CharSequence> indicatorAdapter = ArrayAdapter.createFromResource(this, R.array.indicator_style, android.R.layout.simple_spinner_item);
    indicatorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    indicatorStyle.setAdapter(indicatorAdapter);

    ArrayAdapter<CharSequence> indicatorGraHorAdapter = ArrayAdapter.createFromResource(this, R.array.indicator_gravity_hor, android.R.layout.simple_spinner_item);
    indicatorGraHorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    indicatorGravityHor.setAdapter(indicatorGraHorAdapter);

    ArrayAdapter<CharSequence> indicatorGraVerAdapter = ArrayAdapter.createFromResource(this, R.array.indicator_gravity_ver, android.R.layout.simple_spinner_item);
    indicatorGraVerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    indicatorGravityVer.setAdapter(indicatorGraVerAdapter);

    indicatorStyle.setOnItemSelectedListener(this);
    indicatorGravityHor.setOnItemSelectedListener(this);
    indicatorGravityVer.setOnItemSelectedListener(this);

    loopCheckBox = (CheckBox) findViewById(R.id.loop);
    loopCheckBox.setOnCheckedChangeListener(this);

    autoScrollCheckBox = (CheckBox) findViewById(R.id.autoscroll);
    autoScrollCheckBox.setOnCheckedChangeListener(this);

    indicatorBuildBtn = (Button) findViewById(R.id.indicator_build);
    indicatorBuildBtn.setOnClickListener(this);
}
 
Example #23
Source File: EditScriptActivity.java    From BotLibre with Eclipse Public License 1.0 5 votes vote down vote up
public void save(View view){
	ScriptConfig instance = new ScriptConfig();
	saveProperties(instance);
	
	Spinner spin = (Spinner) findViewById(R.id.scriptLanguageSpin);
	instance.language = (String)spin.getSelectedItem();
	
	HttpAction action= new HttpUpdateAction(this, instance);
	action.execute();
}
 
Example #24
Source File: BasicFunctions.java    From UltimateRecyclerView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loadmore);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    doURV(ultimateRecyclerView);
    bButtons();
    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
    setupSpinnerSelection((Spinner) findViewById(R.id.spinner), spinnerAdapter);
}
 
Example #25
Source File: MainActivityPrinter.java    From Android-POS with MIT License 5 votes vote down vote up
public void initializeAll(){
	mConnectBtn			= (Button) findViewById(R.id.btn_connect);
	mEnableBtn			= (Button) findViewById(R.id.btn_enable);
	btnPrint 		= (Button) findViewById(R.id.btnPrint);
	btnCancel 	= (Button) findViewById(R.id.btnCancel);
	mDeviceSp 			= (Spinner) findViewById(R.id.sp_device);




	sellerNameTv = (TextView) findViewById(R.id.sellerNameTv);
	sellerPhoneTv = (TextView) findViewById(R.id.sellerPhoneTv);
	sellerEmailTv = (TextView) findViewById(R.id.sellerEmailTv);
	customerNameTv = (TextView) findViewById(R.id.customerNameTv);
	customerPhoneTv = (TextView) findViewById(R.id.customerPhoneTv);
	customerEmialTv = (TextView) findViewById(R.id.customerEmialTv);
	invoiceTv = (TextView) findViewById(R.id.invoiceTv);
	totalAmountTv = (TextView) findViewById(R.id.totalAmountTv);
	dueTv = (TextView) findViewById(R.id.dueTv);
	productsName = (TextView) findViewById(R.id.productsName);
	productQuantityTv = (TextView) findViewById(R.id.productQuantityTv);
	productPriceTv = (TextView) findViewById(R.id.productPriceTv);
	totalBillTv = (TextView) findViewById(R.id.totalBillTv);
	discountTv = (TextView) findViewById(R.id.discountTv);
	payableTv = (TextView) findViewById(R.id.payableTv);
	depositTv = (TextView) findViewById(R.id.depositTv);
	currentDueTv = (TextView) findViewById(R.id.currentDueTv);

	printINfo = new PrintSellInfo();
	mBluetoothAdapter	= BluetoothAdapter.getDefaultAdapter();
}
 
Example #26
Source File: DeveloperOptionsDialog.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
private int getIndex(Spinner spinner, String myString) {
    int index = 0;

    for (int i = 0; i < spinner.getCount(); i++) {
        if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(myString)) {
            index = i;
            break;
        }
    }
    return index;
}
 
Example #27
Source File: LauncherActivity.java    From android-apps with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_launcher);
	
	spnView1 = (Spinner) findViewById(R.id.spnView1);
	spnView2 = (Spinner) findViewById(R.id.spnView2);
	spnView3 = (Spinner) findViewById(R.id.spnView3);
	
	ArrayList<String> aList = new ArrayList<String>();
	aList.add("Md. Shahadat");
	aList.add("Sarker");
	aList.add("Developer");
	aList.add("ErrrorPoint");
	
	
	ArrayAdapter<CharSequence> spnViewAdapter1 = ArrayAdapter.createFromResource(this, R.array.res_array_list, R.layout.spinner_item);
	spnViewAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spnView1.setAdapter(spnViewAdapter1);
	
	
	ArrayAdapter<String> spnViewAdapter2 = new ArrayAdapter<String>(this, R.layout.spinner_item, aList);
	spnViewAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spnView2.setAdapter(spnViewAdapter2);
	
	String[] iName = {"Md. Shahadat Sarker","Android","Mobile"};
	String[] iAbout = {"The Developer","This is an OS","A Device"};
	Integer[] iICon = {R.drawable.sarker,R.drawable.ic_launcher,R.drawable.ic_launcher};
	
	spnView3.setAdapter(new CustomSpinnerAdapter(this, R.layout.spinner_row, iName, iName, iAbout, iICon));
	
	Toast.makeText(this, "Selected: " + spnView3.getSelectedItem(), 500).show();
}
 
Example #28
Source File: MainActivity.java    From api-samples with MIT License 5 votes vote down vote up
@Override
protected void onCreate (Bundle savedInstanceState)
{
    super.onCreate( savedInstanceState );

    setContentView(R.layout.demo);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    in_call = false;
    room_edit = ( EditText )findViewById( R.id.room_name );
    join_button = ( Button )findViewById( R.id.join_button );
    status = ( TextView )findViewById( R.id.status );
    loader_spinner = ( ImageView )findViewById( R.id.loader_spinner );
    call_layout = ( MediaStreamLayout )findViewById( R.id.call_layout );
    room_edit.setText(DEFAULT_ROOM_NAME);
    room_layout = ( LinearLayout )findViewById( R.id.room_layout );
    orientation_landscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
    if ( orientation_landscape ) {
        room_layout.setOrientation(LinearLayout.HORIZONTAL);
    } else {
        room_layout.setOrientation(LinearLayout.VERTICAL);
    }
    select_camera = ( Spinner )findViewById( R.id.select_camera );

    // Conference
    conference = Conference.getInstance( getApplicationContext() );
    conference.setInfo( "38077edb", "4f304359baa6d0fd1f9106aaeb116f33" );

    conference.setVideoOption( VideoOption.MAX_WIDTH, 320 );
    conference.setVideoOption( VideoOption.MAX_HEIGHT, 240 );
    conference.setVideoOption( VideoOption.MAX_FRAME_RATE, 15 );

    conference.setAudioOption( AudioOption.PREFERRED_CODEC, AudioCodec.ISAC );
    conference.setAudioOption( AudioOption.PREFERRED_CODEC_CLOCKRATE, 16000 );
    conference.setLoudspeaker( false );
    init();
}
 
Example #29
Source File: ComposerVideoEffectActivity.java    From media-for-mobile with Apache License 2.0 5 votes vote down vote up
private void init() {
    mItem = (TimelineItem) findViewById(R.id.timelineItem);
    mItem.setEventsListener(this);
    mItem.enableSegmentPicker(false);

    ((Button) findViewById(R.id.action)).setOnClickListener(this);

    mEffects = (Spinner) findViewById(R.id.effect);

    fillEffectsList();
}
 
Example #30
Source File: SettingsActivity.java    From DroidPlay with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	setContentView(R.layout.settings);
	
	// action bar icon as home link
	ActionBar actionBar = getActionBar();
	actionBar.setSubtitle("Settings");
	actionBar.setHomeButtonEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.setDisplayHomeAsUpEnabled(true); 
	
	// preferences
	prefs = getSharedPreferences("DroidPlay", 0);
	
	// server port
	serverPort = (EditText) findViewById(R.id.server_port);
	
	// image transition
	ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.image_transition_item, R.id.transition, AirPlayUtils.getTransitionDescriptions());
	imageTransition = (Spinner) findViewById(R.id.image_transition);
	imageTransition.setAdapter(adapter);
	
	// load settings
	loadSettings();
}