Search in sources :

Example 51 with Spinner

use of android.widget.Spinner in project ETSMobile-Android2 by ApplETS.

the class ProfileAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        if (position == 0) {
            convertView = LayoutInflater.from(context).inflate(R.layout.row_profile_info_etudiant, parent, false);
            InfoEtudiantViewHolder infoEtudiantViewHolder = new InfoEtudiantViewHolder();
            infoEtudiantViewHolder.tvNomPrenom = (TextView) convertView.findViewById(R.id.profil_nom_prenom_item);
            infoEtudiantViewHolder.tvCodePermanent = (TextView) convertView.findViewById(R.id.profil_code_permanent_item);
            infoEtudiantViewHolder.tvSolde = (TextView) convertView.findViewById(R.id.profil_solde_item);
            infoEtudiantViewHolder.tvCodeUniversel = (TextView) convertView.findViewById(R.id.profil_code_universel_item);
            convertView.setTag(infoEtudiantViewHolder);
        } else if (position == 1) {
            convertView = LayoutInflater.from(context).inflate(R.layout.row_profile_liste_programmes, parent, false);
            ListProgramViewHolder listProgramViewHolder = new ListProgramViewHolder();
            listProgramViewHolder.spinnerProgram = (Spinner) convertView.findViewById(R.id.spinner_programmes);
            listProgramViewHolder.tvCoursEchoues = (TextView) convertView.findViewById(R.id.profil_credit_echoue_item);
            listProgramViewHolder.tvCoursEquivalents = (TextView) convertView.findViewById(R.id.profil_cours_equivalent_item);
            listProgramViewHolder.tvCoursReussis = (TextView) convertView.findViewById(R.id.profil_cours_reussis_item);
            listProgramViewHolder.tvCreditsInscrits = (TextView) convertView.findViewById(R.id.profil_credit_inscrit_item);
            listProgramViewHolder.tvCreditsReussis = (TextView) convertView.findViewById(R.id.profil_credit_reussis_item);
            listProgramViewHolder.tvMoyenne = (TextView) convertView.findViewById(R.id.profil_moyenne_item);
            convertView.setTag(listProgramViewHolder);
        }
    }
    if (position == 0) {
        InfoEtudiantViewHolder infoEtudiantViewHolder = (InfoEtudiantViewHolder) convertView.getTag();
        String nom = etudiant.nom != null ? etudiant.nom.trim() : "";
        String prenom = etudiant.prenom != null ? etudiant.prenom.trim() : "";
        infoEtudiantViewHolder.tvNomPrenom.setText(nom + ", " + prenom);
        infoEtudiantViewHolder.tvCodePermanent.setText(etudiant.codePerm);
        infoEtudiantViewHolder.tvSolde.setText(etudiant.soldeTotal);
        infoEtudiantViewHolder.tvCodeUniversel.setText((ApplicationManager.userCredentials.getUsername()).toUpperCase());
    } else if (position == 1) {
        final ListProgramViewHolder listProgramViewHolder = (ListProgramViewHolder) convertView.getTag();
        listProgramViewHolder.spinnerProgram.setAdapter(profileSpinnerAdapter);
        Programme programme = (Programme) listProgramViewHolder.spinnerProgram.getSelectedItem();
        listProgramViewHolder.tvMoyenne.setText(programme.moyenne);
        listProgramViewHolder.tvCreditsReussis.setText(programme.nbCreditsCompletes);
        listProgramViewHolder.tvCreditsInscrits.setText(programme.nbCreditsInscrits);
        listProgramViewHolder.tvCoursReussis.setText(programme.nbCrsReussis);
        listProgramViewHolder.tvCoursEquivalents.setText(programme.nbEquivalences);
        listProgramViewHolder.tvCoursEchoues.setText(programme.nbCrsEchoues);
        listProgramViewHolder.spinnerProgram.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                //                    notifyDataSetChanged();
                Programme selectedProgramme = profileSpinnerAdapter.getItem(position);
                listProgramViewHolder.tvMoyenne.setText(selectedProgramme.moyenne);
                listProgramViewHolder.tvCreditsReussis.setText(selectedProgramme.nbCreditsCompletes);
                listProgramViewHolder.tvCreditsInscrits.setText(selectedProgramme.nbCreditsInscrits);
                listProgramViewHolder.tvCoursReussis.setText(selectedProgramme.nbCrsReussis);
                listProgramViewHolder.tvCoursEquivalents.setText(selectedProgramme.nbEquivalences);
                listProgramViewHolder.tvCoursEchoues.setText(selectedProgramme.nbCrsEchoues);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        });
    }
    return convertView;
}
Also used : Spinner(android.widget.Spinner) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) Programme(ca.etsmtl.applets.etsmobile.model.Programme)

Example 52 with Spinner

use of android.widget.Spinner in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class UserDictionaryAddWordFragment method updateSpinner.

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);
}
Also used : LocaleRenderer(com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer) Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 53 with Spinner

use of android.widget.Spinner in project UltimateAndroid by cymcsg.

the class ConfigureStandupTimer method onClick.

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);
    }
}
Also used : Spinner(android.widget.Spinner) Intent(android.content.Intent) TextView(android.widget.TextView)

Example 54 with Spinner

use of android.widget.Spinner in project AntennaPod by AntennaPod.

the class ProxyDialog method createDialog.

public Dialog createDialog() {
    dialog = new MaterialDialog.Builder(context).title(R.string.pref_proxy_title).customView(R.layout.proxy_settings, true).positiveText(R.string.proxy_test_label).negativeText(R.string.cancel_label).onPositive((dialog1, which) -> {
        if (!testSuccessful) {
            dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
            test();
            return;
        }
        String type = (String) ((Spinner) dialog1.findViewById(R.id.spType)).getSelectedItem();
        ProxyConfig proxy;
        if (Proxy.Type.valueOf(type) == Proxy.Type.DIRECT) {
            proxy = ProxyConfig.direct();
        } else {
            String host = etHost.getText().toString();
            String port = etPort.getText().toString();
            String username = etUsername.getText().toString();
            if (TextUtils.isEmpty(username)) {
                username = null;
            }
            String password = etPassword.getText().toString();
            if (TextUtils.isEmpty(password)) {
                password = null;
            }
            int portValue = 0;
            if (!TextUtils.isEmpty(port)) {
                portValue = Integer.valueOf(port);
            }
            proxy = ProxyConfig.http(host, portValue, username, password);
        }
        UserPreferences.setProxyConfig(proxy);
        AntennapodHttpClient.reinit();
        dialog.dismiss();
    }).onNegative((dialog1, which) -> dialog1.dismiss()).autoDismiss(false).build();
    View view = dialog.getCustomView();
    spType = (Spinner) view.findViewById(R.id.spType);
    String[] types = { Proxy.Type.DIRECT.name(), Proxy.Type.HTTP.name() };
    ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, types);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spType.setAdapter(adapter);
    ProxyConfig proxyConfig = UserPreferences.getProxyConfig();
    spType.setSelection(adapter.getPosition(proxyConfig.type.name()));
    etHost = (EditText) view.findViewById(R.id.etHost);
    if (!TextUtils.isEmpty(proxyConfig.host)) {
        etHost.setText(proxyConfig.host);
    }
    etHost.addTextChangedListener(requireTestOnChange);
    etPort = (EditText) view.findViewById(R.id.etPort);
    if (proxyConfig.port > 0) {
        etPort.setText(String.valueOf(proxyConfig.port));
    }
    etPort.addTextChangedListener(requireTestOnChange);
    etUsername = (EditText) view.findViewById(R.id.etUsername);
    if (!TextUtils.isEmpty(proxyConfig.username)) {
        etUsername.setText(proxyConfig.username);
    }
    etUsername.addTextChangedListener(requireTestOnChange);
    etPassword = (EditText) view.findViewById(R.id.etPassword);
    if (!TextUtils.isEmpty(proxyConfig.password)) {
        etPassword.setText(proxyConfig.username);
    }
    etPassword.addTextChangedListener(requireTestOnChange);
    if (proxyConfig.type == Proxy.Type.DIRECT) {
        enableSettings(false);
        setTestRequired(false);
    }
    spType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            enableSettings(position > 0);
            setTestRequired(position > 0);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            enableSettings(false);
        }
    });
    txtvMessage = (TextView) view.findViewById(R.id.txtvMessage);
    checkValidity();
    return dialog;
}
Also used : Context(android.content.Context) SocketAddress(java.net.SocketAddress) AndroidSchedulers(rx.android.schedulers.AndroidSchedulers) Dialog(android.app.Dialog) Editable(android.text.Editable) TypedArray(android.content.res.TypedArray) Observable(rx.Observable) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) MDButton(com.afollestad.materialdialogs.internal.MDButton) Patterns(android.util.Patterns) Proxy(java.net.Proxy) Schedulers(rx.schedulers.Schedulers) View(android.view.View) Response(okhttp3.Response) AdapterView(android.widget.AdapterView) AntennapodHttpClient(de.danoeh.antennapod.core.service.download.AntennapodHttpClient) Request(okhttp3.Request) Subscriber(rx.Subscriber) R(de.danoeh.antennapod.R) ContextCompat(android.support.v4.content.ContextCompat) TextUtils(android.text.TextUtils) DialogAction(com.afollestad.materialdialogs.DialogAction) IOException(java.io.IOException) Credentials(okhttp3.Credentials) InetSocketAddress(java.net.InetSocketAddress) ProxyConfig(de.danoeh.antennapod.core.service.download.ProxyConfig) Spinner(android.widget.Spinner) TimeUnit(java.util.concurrent.TimeUnit) ArrayAdapter(android.widget.ArrayAdapter) TextView(android.widget.TextView) OkHttpClient(okhttp3.OkHttpClient) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Subscription(rx.Subscription) EditText(android.widget.EditText) TextWatcher(android.text.TextWatcher) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ProxyConfig(de.danoeh.antennapod.core.service.download.ProxyConfig) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 55 with Spinner

use of android.widget.Spinner in project AntennaPod by AntennaPod.

the class OnlineFeedViewActivity method showFeedInformation.

/**
     * Called when feed parsed successfully.
     * This method is executed on the GUI thread.
     */
private void showFeedInformation(final Feed feed, Map<String, String> alternateFeedUrls) {
    setContentView(R.layout.listview_activity);
    this.feed = feed;
    this.selectedDownloadUrl = feed.getDownload_url();
    EventDistributor.getInstance().register(listener);
    ListView listView = (ListView) findViewById(R.id.listview);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View header = inflater.inflate(R.layout.onlinefeedview_header, listView, false);
    listView.addHeaderView(header);
    listView.setAdapter(new FeedItemlistDescriptionAdapter(this, 0, feed.getItems()));
    ImageView cover = (ImageView) header.findViewById(R.id.imgvCover);
    TextView title = (TextView) header.findViewById(R.id.txtvTitle);
    TextView author = (TextView) header.findViewById(R.id.txtvAuthor);
    TextView description = (TextView) header.findViewById(R.id.txtvDescription);
    Spinner spAlternateUrls = (Spinner) header.findViewById(R.id.spinnerAlternateUrls);
    subscribeButton = (Button) header.findViewById(R.id.butSubscribe);
    if (feed.getImage() != null && StringUtils.isNotBlank(feed.getImage().getDownload_url())) {
        Glide.with(this).load(feed.getImage().getDownload_url()).placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate().into(cover);
    }
    title.setText(feed.getTitle());
    author.setText(feed.getAuthor());
    description.setText(feed.getDescription());
    subscribeButton.setOnClickListener(v -> {
        if (feed != null && feedInFeedlist(feed)) {
            Intent intent = new Intent(OnlineFeedViewActivity.this, MainActivity.class);
            intent.putExtra(MainActivity.EXTRA_FEED_ID, getFeedId(feed));
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        } else {
            Feed f = new Feed(selectedDownloadUrl, null, feed.getTitle());
            f.setPreferences(feed.getPreferences());
            this.feed = f;
            try {
                DownloadRequester.getInstance().downloadFeed(this, f);
            } catch (DownloadRequestException e) {
                Log.e(TAG, Log.getStackTraceString(e));
                DownloadRequestErrorDialogCreator.newRequestErrorDialog(this, e.getMessage());
            }
            setSubscribeButtonState(feed);
        }
    });
    if (alternateFeedUrls.isEmpty()) {
        spAlternateUrls.setVisibility(View.GONE);
    } else {
        spAlternateUrls.setVisibility(View.VISIBLE);
        final List<String> alternateUrlsList = new ArrayList<>();
        final List<String> alternateUrlsTitleList = new ArrayList<>();
        alternateUrlsList.add(feed.getDownload_url());
        alternateUrlsTitleList.add(feed.getTitle());
        alternateUrlsList.addAll(alternateFeedUrls.keySet());
        for (String url : alternateFeedUrls.keySet()) {
            alternateUrlsTitleList.add(alternateFeedUrls.get(url));
        }
        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, alternateUrlsTitleList);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spAlternateUrls.setAdapter(adapter);
        spAlternateUrls.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                selectedDownloadUrl = alternateUrlsList.get(position);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        });
    }
    setSubscribeButtonState(feed);
}
Also used : Spinner(android.widget.Spinner) ArrayList(java.util.ArrayList) Intent(android.content.Intent) DownloadRequestException(de.danoeh.antennapod.core.storage.DownloadRequestException) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) FeedItemlistDescriptionAdapter(de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) ArrayAdapter(android.widget.ArrayAdapter) Feed(de.danoeh.antennapod.core.feed.Feed)

Aggregations

Spinner (android.widget.Spinner)160 View (android.view.View)70 AdapterView (android.widget.AdapterView)58 TextView (android.widget.TextView)51 ArrayAdapter (android.widget.ArrayAdapter)50 LinearLayout (android.widget.LinearLayout)29 EditText (android.widget.EditText)20 Intent (android.content.Intent)19 Button (android.widget.Button)19 RecyclerView (android.support.v7.widget.RecyclerView)18 CompoundButton (android.widget.CompoundButton)16 ViewGroup (android.view.ViewGroup)13 ImageView (android.widget.ImageView)13 DialogInterface (android.content.DialogInterface)12 CheckBox (android.widget.CheckBox)11 ListView (android.widget.ListView)11 ArrayList (java.util.ArrayList)11 AutoCompleteTextView (android.widget.AutoCompleteTextView)9 AlertDialog (android.app.AlertDialog)7 LayoutInflater (android.view.LayoutInflater)7