Android Open Source - GAMr Misc Qual View






From Project

Back to project page GAMr.

License

The source code is released under:

GNU General Public License

If you think the Android project GAMr listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gamr.gamr;
//from  ww w . ja  va 2s.com
import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;

/**
 * Created by beni on 1/11/15.
 */
public class MiscQualView extends LinearLayout implements AdapterView.OnItemSelectedListener {
    private NameValuePair nvp;

    private String key;
    private String selection;


    public MiscQualView(Context context, String key, String value) {
        super(context);
        setOrientation(HORIZONTAL);


        // Add input element
        if(value.contains("Combo Box")) {
            // Add label

            TextView label = new TextView(context);
            label.setText(key);
            addView(label);

            // Generate spinner
            String temp = value.replace("Combo Box (", "");
            temp = temp.replace(")", "");
            String[] spinnerOptions = temp.split(", ");
            ArrayList<String> spinnerArray = new ArrayList<String>();
            for(String option : spinnerOptions) spinnerArray.add(option);

            Spinner spinner = new Spinner(context);
            ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
            spinner.setAdapter(spinnerArrayAdapter);

            addView(spinner);
        }
        else if(value.contains("Numeric")) {
            // Numeric range
        }
        else {
            // plain text input

        }
    }

    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        nvp = new BasicNameValuePair(key, selection);
    }

    @Override
    public void onNothingSelected(AdapterView<?> adapterView) {}
}




Java Source Code List

com.gamr.gamr.BuildConfig.java
com.gamr.gamr.HomeActivity.java
com.gamr.gamr.LoginActivity.java
com.gamr.gamr.MiscQualView.java
com.gamr.gamr.PostFragment.java
com.gamr.gamr.RegisterActivity.java
com.gamr.gamr.SearchFragment.java
com.gamr.gamr.TabListener.java
com.gamr.gamr.ViewProfileActivity.java