Example usage for android.widget RadioGroup setOnCheckedChangeListener

List of usage examples for android.widget RadioGroup setOnCheckedChangeListener

Introduction

In this page you can find the example usage for android.widget RadioGroup setOnCheckedChangeListener.

Prototype

public void setOnCheckedChangeListener(OnCheckedChangeListener listener) 

Source Link

Document

Register a callback to be invoked when the checked radio button changes in this group.

Usage

From source file:jp.co.rediscovery.firstflight.ConfigFragment.java

/**
 * ???/*from  w ww  .j  ava  2 s. com*/
 * @param root
 */
private void initConfigOperation(final View root) {
    if (DEBUG)
        Log.v(TAG, "initConfigOperation:");
    final RadioGroup group = root.findViewById(R.id.operation_radiogroup);
    switch (mPref.getInt(APP_CONFIG_KEY_OPERATION_TYPE, 0)) {
    case 1: // 2
        group.check(R.id.operation_mode2_radiobutton);
        break;
    case 0: // 1
        group.check(R.id.operation_mode1_radiobutton);
    default:
        break;
    }
    group.setOnCheckedChangeListener(mOnRadioButtonCheckedChangeListener);

}

From source file:am.project.x.business.widgets.statelayout.StateLayoutActivity.java

@Override
protected void initializeActivity(@Nullable Bundle savedInstanceState) {
    setSupportActionBar(R.id.sl_toolbar);
    mVState = findViewById(R.id.sl_lyt_state);
    final RadioGroup state = findViewById(R.id.sl_rg_state);
    final RadioGroup mode = findViewById(R.id.sl_rg_mode);
    mDLoading = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_loading);
    mDError = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_error);
    mDEmpty = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_empty);
    final AppCompatTextView loading = new AppCompatTextView(this);
    loading.setText(R.string.sl_change_state_loading);
    loading.setTextColor(0xfff2f71c);//  w w w. j  av a  2s . com
    loading.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64);
    mVLoading = loading;
    final AppCompatTextView error = new AppCompatTextView(this);
    error.setText(R.string.sl_change_state_error);
    error.setTextColor(0xffff4081);
    error.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64);
    mVError = error;
    final AppCompatTextView empty = new AppCompatTextView(this);
    empty.setText(R.string.sl_change_state_empty);
    empty.setTextColor(0xff092d6d);
    empty.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64);
    mVEmpty = empty;

    mVState.setOnStateClickListener(this);
    state.setOnCheckedChangeListener(this);
    state.check(R.id.sl_rb_normal);
    mode.setOnCheckedChangeListener(this);
    mode.check(R.id.sl_rb_drawable);
}

From source file:com.ubikod.capptain.android.sdk.reach.activity.CapptainPollActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    /* Init layout */
    super.onCreate(savedInstanceState);

    /* If no content, nothing to do, super class already called finish */
    if (mContent == null)
        return;//  ww w.ja  v a 2  s .  c  o m

    /* Render questions */
    LinearLayout questionsLayout = getView("questions");
    JSONArray questions = mContent.getQuestions();
    LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    try {
        for (int i = 0; i < questions.length(); i++) {
            /* Get question */
            JSONObject question = questions.getJSONObject(i);

            /* Inflate question layout */
            LinearLayout questionLayout = (LinearLayout) layoutInflater
                    .inflate(getLayoutId("capptain_poll_question"), null);

            /* Set question's title */
            TextView questionTitle = (TextView) questionLayout.findViewById(getId("question_title"));
            questionTitle.setText(question.getString("title"));

            /* Set choices */
            RadioGroup choicesView = (RadioGroup) questionLayout.findViewById(getId("choices"));
            choicesView.setTag(question);
            JSONArray choices = question.getJSONArray("choices");
            int choiceViewId = 0;
            for (int j = 0; j < choices.length(); j++) {
                /* Get choice */
                JSONObject choice = choices.getJSONObject(j);

                /* Inflate choice layout */
                RadioButton choiceView = (RadioButton) layoutInflater
                        .inflate(getLayoutId("capptain_poll_choice"), null);

                /* Each choice is a radio button */
                choiceView.setId(choiceViewId++);
                choiceView.setTag(choice.getString("id"));
                choiceView.setText(choice.getString("title"));
                choiceView.setChecked(choice.getBoolean("default"));
                choicesView.addView(choiceView);
            }

            /* Add to parent layouts */
            questionsLayout.addView(questionLayout);

            /* Watch state */
            mRadioGroups.add(choicesView);
            choicesView.setOnCheckedChangeListener(mRadioGroupListener);
        }
    } catch (JSONException jsone) {
        /* Won't happen */
    }

    /* Disable action if a choice is not selected */
    updateActionState();
}

From source file:com.partypoker.poker.engagement.reach.activity.EngagementPollActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    /* Init layout */
    super.onCreate(savedInstanceState);

    /* If no content, nothing to do, super class already called finish */
    if (mContent == null)
        return;/*from   w  w w.  j av  a  2s. com*/

    /* Render questions */
    LinearLayout questionsLayout = getView("questions");
    JSONArray questions = mContent.getQuestions();
    LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    try {
        for (int i = 0; i < questions.length(); i++) {
            /* Get question */
            JSONObject question = questions.getJSONObject(i);

            /* Inflate question layout */
            LinearLayout questionLayout = (LinearLayout) layoutInflater
                    .inflate(getLayoutId("engagement_poll_question"), null);

            /* Set question's title */
            TextView questionTitle = (TextView) questionLayout.findViewById(getId("question_title"));
            questionTitle.setText(question.getString("title"));

            /* Set choices */
            RadioGroup choicesView = (RadioGroup) questionLayout.findViewById(getId("choices"));
            choicesView.setTag(question);
            JSONArray choices = question.getJSONArray("choices");
            int choiceViewId = 0;
            for (int j = 0; j < choices.length(); j++) {
                /* Get choice */
                JSONObject choice = choices.getJSONObject(j);

                /* Inflate choice layout */
                RadioButton choiceView = (RadioButton) layoutInflater
                        .inflate(getLayoutId("engagement_poll_choice"), null);

                /* Each choice is a radio button */
                choiceView.setId(choiceViewId++);
                choiceView.setTag(choice.getString("id"));
                choiceView.setText(choice.getString("title"));
                choiceView.setChecked(choice.optBoolean("isDefault"));
                choicesView.addView(choiceView);
            }

            /* Add to parent layouts */
            questionsLayout.addView(questionLayout);

            /* Watch state */
            mRadioGroups.add(choicesView);
            choicesView.setOnCheckedChangeListener(mRadioGroupListener);
        }
    } catch (JSONException jsone) {
        /* Drop on parsing error */
        mContent.dropContent(this);
        finish();
        return;
    }

    /* Disable action if a choice is not selected */
    updateActionState();
}

From source file:com.serenegiant.aceparrot.ConfigFragment.java

/**
 * ??? FIXME // ww w. j  a va 2 s.  c  o m
 * @param root
 */
private void initConfigNetwork(final View root) {
    final IWiFiController wifi = (mController instanceof IWiFiController) ? (IWiFiController) mController
            : null;
    final RadioGroup group = (RadioGroup) root.findViewById(R.id.network_wifi_mode_radiogroup);
    if (wifi != null) {
        final boolean outdoor = wifi.isOutdoor();
        group.check(outdoor ? R.id.network_outdoor_radiobutton : R.id.network_indoor_radiobutton);
        group.setOnCheckedChangeListener(mOnRadioButtonCheckedChangeListener);
    } else {
        group.check(R.id.network_indoor_radiobutton);
        group.setEnabled(false);
    }
}

From source file:com.serenegiant.aceparrot.ConfigFragment.java

/**
 * ???/*w ww.java 2s  .c o  m*/
 * @param root
 */
private void initConfigOperation(final View root) {
    if (DEBUG)
        Log.v(TAG, "initConfigOperation:");
    final RadioGroup group = (RadioGroup) root.findViewById(R.id.operation_radiogroup);
    switch (mPref.getInt(KEY_OPERATION_TYPE, 0)) {
    case 1: // ???
        group.check(R.id.operation_reverse_radiobutton);
        break;
    case 2: // 1
        group.check(R.id.operation_mode1_radiobutton);
        break;
    case 3: // 2
        group.check(R.id.operation_mode2_radiobutton);
        break;
    case 0:
    default: // 
        group.check(R.id.operation_normal_radiobutton);
        break;
    }
    group.setOnCheckedChangeListener(mOnRadioButtonCheckedChangeListener);

    final CheckBox checkbox = (CheckBox) root.findViewById(R.id.operation_touch_checkbox);
    checkbox.setChecked(mPref.getBoolean(KEY_OPERATION_TOUCH, false));
    checkbox.setOnCheckedChangeListener(mOnCheckedChangeListener);
}

From source file:dev.ukanth.ufirewall.MainActivity.java

private void updateRadioFilter() {
    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.appFilterGroup);
    radioGroup.setOnCheckedChangeListener(this);
}

From source file:apps.junkuvo.alertapptowalksafely.MainActivity.java

public void setRadioGroupInLayout(View layout) {
    RadioGroup radioGroup = (RadioGroup) layout.findViewById(R.id.radiogroup);
    RadioButton radioButtonTop = (RadioButton) layout.findViewById(R.id.radiobutton_top);
    RadioButton radioButtonCenter = (RadioButton) layout.findViewById(R.id.radiobutton_center);
    RadioButton radioButtonButton = (RadioButton) layout.findViewById(R.id.radiobutton_bottom);
    switch (mToastPosition) {
    case Gravity.TOP:
        radioButtonTop.setChecked(true);
        break;//w  w  w. j  ava2  s. c  o  m
    case Gravity.CENTER:
        radioButtonCenter.setChecked(true);
        break;
    case Gravity.BOTTOM:
        radioButtonButton.setChecked(true);
        break;
    }

    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch (checkedId) {
            case R.id.radiobutton_top:
                mToastPosition = Gravity.TOP;
                break;
            case R.id.radiobutton_center:
                mToastPosition = Gravity.CENTER;
                if (mAlertService != null) {
                    mAlertService.setToastPosition(Gravity.CENTER);
                }
                break;
            case R.id.radiobutton_bottom:
                mToastPosition = Gravity.BOTTOM;
                break;
            }
            if (mAlertService != null && mAlertService.isBoundService()) {
                mAlertService.setToastPosition(mToastPosition);
            }
        }
    });
}

From source file:reportsas.com.formulapp.Formulario.java

public LinearLayout obtenerLayout(LayoutInflater infla, Pregunta preg) {
    int id;/*from w w  w.  ja  va 2 s.  c  om*/
    int tipo_pregunta = preg.getTipoPregunta();
    LinearLayout pregunta;
    TextView textView;
    TextView textAyuda;
    switch (tipo_pregunta) {
    case 1:
        id = R.layout.pregunta_texto;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloPregunta);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        break;
    case 2:
        id = R.layout.pregunta_multitexto;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.mtxtTritulo);
        textAyuda = (TextView) pregunta.findViewById(R.id.mtxtAyuda);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());

        break;
    case 3:
        id = R.layout.pregunta_seleccion;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloSeleccion);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_seleccion);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        RadioGroup rg = (RadioGroup) pregunta.findViewById(R.id.opcionesUnica);
        ArrayList<OpcionForm> opciones = preg.getOpciones();
        final ArrayList<RadioButton> rb = new ArrayList<RadioButton>();

        for (int i = 0; i < opciones.size(); i++) {
            OpcionForm opcion = opciones.get(i);
            rb.add(new RadioButton(this));
            rg.addView(rb.get(i));
            rb.get(i).setText(opcion.getEtInicial());

        }
        final TextView respt = (TextView) pregunta.findViewById(R.id.respuestaGruop);
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                int radioButtonID = group.getCheckedRadioButtonId();
                RadioButton radioButton = (RadioButton) group.findViewById(radioButtonID);
                respt.setText(radioButton.getText());
            }
        });

        break;
    case 4:
        id = R.layout.pregunta_multiple;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloMultiple);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_mltiple);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        ArrayList<OpcionForm> opciones2 = preg.getOpciones();
        final EditText ediOtros = new EditText(this);
        ArrayList<CheckBox> cb = new ArrayList<CheckBox>();

        for (int i = 0; i < opciones2.size(); i++) {
            OpcionForm opcion = opciones2.get(i);
            cb.add(new CheckBox(this));
            pregunta.addView(cb.get(i));
            cb.get(i).setText(opcion.getEtInicial());
            if (opcion.getEditble().equals("S")) {

                ediOtros.setEnabled(false);
                ediOtros.setId(R.id.edtTexto);
                pregunta.addView(ediOtros);
                cb.get(i).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        if (isChecked) {
                            ediOtros.setEnabled(true);
                        } else {
                            ediOtros.setText("");
                            ediOtros.setEnabled(false);
                        }
                    }
                });
            }

        }
        TextView spacio = new TextView(this);
        spacio.setText("        ");
        spacio.setVisibility(View.INVISIBLE);
        pregunta.addView(spacio);
        break;
    case 5:
        id = R.layout.pregunta_escala;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloEscala);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_escala);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());

        TextView etInicial = (TextView) pregunta.findViewById(R.id.etInicial);
        TextView etFinal = (TextView) pregunta.findViewById(R.id.etFinal);
        OpcionForm opci = preg.getOpciones().get(0);
        etInicial.setText(opci.getEtInicial());
        etFinal.setText(opci.getEtFinal());
        final TextView respEscala = (TextView) pregunta.findViewById(R.id.seleEscala);
        RatingBar rtBar = (RatingBar) pregunta.findViewById(R.id.escala);
        rtBar.setNumStars(Integer.parseInt(opci.getValores().get(0).getDescripcion()));
        rtBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
                respEscala.setText("" + Math.round(rating));
            }
        });

        break;
    case 6:
        id = R.layout.pregunta_lista;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloLista);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_lista);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        ArrayList<OpcionForm> opciones3 = preg.getOpciones();
        //Creamos la lista
        LinkedList<ObjetoSpinner> opcn = new LinkedList<ObjetoSpinner>();
        //La poblamos con los ejemplos
        for (int i = 0; i < opciones3.size(); i++) {
            opcn.add(new ObjetoSpinner(opciones3.get(i).getIdOpcion(), opciones3.get(i).getEtInicial()));
        }

        //Creamos el adaptador*/
        Spinner listad = (Spinner) pregunta.findViewById(R.id.opcionesListado);
        ArrayAdapter<ObjetoSpinner> spinner_adapter = new ArrayAdapter<ObjetoSpinner>(this,
                android.R.layout.simple_spinner_item, opcn);
        //Aadimos el layout para el men y se lo damos al spinner
        spinner_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listad.setAdapter(spinner_adapter);

        break;
    case 7:
        id = R.layout.pregunta_tabla;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloTabla);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_tabla);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        TableLayout tba = (TableLayout) pregunta.findViewById(R.id.tablaOpciones);
        ArrayList<OpcionForm> opciones4 = preg.getOpciones();
        ArrayList<RadioButton> radiosbotonoes = new ArrayList<RadioButton>();
        for (int i = 0; i < opciones4.size(); i++) {
            TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.row_pregunta_tabla, null);
            RadioGroup tg_valores = (RadioGroup) row.findViewById(R.id.valoresRow);

            final ArrayList<RadioButton> valoOpc = new ArrayList<RadioButton>();
            ArrayList<Valor> valoresT = opciones4.get(i).getValores();
            for (int k = 0; k < valoresT.size(); k++) {
                RadioButton rb_nuevo = new RadioButton(this);
                rb_nuevo.setText(valoresT.get(k).getDescripcion());
                tg_valores.addView(rb_nuevo);
                valoOpc.add(rb_nuevo);
            }

            ((TextView) row.findViewById(R.id.textoRow)).setText(opciones4.get(i).getEtInicial());
            tba.addView(row);
        }
        TextView espacio = new TextView(this);
        espacio.setText("        ");
        pregunta.addView(espacio);
        break;
    case 8:
        id = R.layout.pregunta_fecha;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloFecha);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_fecha);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());

        break;
    case 9:
        id = R.layout.pregunta_hora;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloHora);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_hora);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());

        break;
    default:
        id = R.layout.pregunta_multiple;
        pregunta = (LinearLayout) infla.inflate(id, null, false);

        textView = (TextView) pregunta.findViewById(R.id.TituloMultiple);
        textAyuda = (TextView) pregunta.findViewById(R.id.texto_ayuda_mltiple);
        textView.setText(preg.getOrden() + ". " + preg.getTitulo());
        textAyuda.setText(preg.getTxtAyuda());
        break;
    }

    return pregunta;
}

From source file:com.f8full.casserolesencours.CasserolesEnCoursActivity.java

/** Called when the activity is first created. */
@Override//from w  w w.  j a va  2s .c  om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Logger.getLogger("com.google.api.client").setLevel(LOGGING_LEVEL);

    //That ease dev of technical stuff BUT is not wanted on a mid/longer term
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mTimeFilterSpinner = (Spinner) findViewById(R.id.timeFilterSpinner);
    mTimeFilterAdapter = ArrayAdapter.createFromResource(this, R.array.timeFilter_choices,
            android.R.layout.simple_spinner_item);
    mTimeFilterAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    mTimeFilterSpinner.setAdapter(mTimeFilterAdapter);

    mDistanceFilterSpinner = (Spinner) findViewById(R.id.distanceFilterSpinner);
    mDistanceFilterAdapter = ArrayAdapter.createFromResource(this, R.array.distanceFilter_choices,
            android.R.layout.simple_spinner_item);
    mDistanceFilterAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    mDistanceFilterSpinner.setAdapter(mDistanceFilterAdapter);

    mAloharAuthLayout = findViewById(R.id.auth_layout);
    mMainLayout = findViewById(R.id.main_layout);
    mProgress = findViewById(R.id.progress_spin);

    mAccountView = (TextView) findViewById(R.id.account);

    mMainHandler = new Handler();

    mStatusView = (TextView) findViewById(R.id.service_status);
    mServiceToggleButton = (ToggleButton) findViewById(R.id.toggle);
    mUIDView = (EditText) findViewById(R.id.uid);

    mNotificationManager = (NotificationManager) getSystemService(NOTIFIACTION_SERVICE_STRING);

    mAlohar = Alohar.init(getApplication());

    mPlaceManager = mAlohar.getPlaceManager();
    mMotionManager = mAlohar.getMotionManager();

    //mEventManager = EventsManager.getInstance();
    //register listener
    //mPlaceManager.registerPlaceEventListener(mEventManager);
    mMotionManager.registerMotionListener(this);

    //Alohar original, I'm testing the other one
    //mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE);

    mAloharUid = mPrefs.getString(PREF_KEY, null);
    if (mAloharUid == null) {
        mAlohar.register(APP_ID, API_KEY, this);
    }

    mFusionTableEncID = mPrefs.getString(PREF_TABLE_ENCID, null);

    mRegisterRequestTableID = mPrefs.getString(PREF_REGREQUESTTABLE_ENCID, null);

    if (mRegisterRequestTableID == null) {
        ((Button) findViewById(R.id.refreshRegistration)).setEnabled(false);
    } else {
        ((Button) findViewById(R.id.refreshRegistration)).setEnabled(true);
        ((Button) findViewById(R.id.registerTable)).setEnabled(false);
    }

    mViewOnMasterID = mPrefs.getString(PREF_VIEWONMASTERTABLE_ENCID, null);

    if (mViewOnMasterID == null) {
        ((Button) findViewById(R.id.refreshRegistration)).setEnabled(true);
    } else {
        ((Button) findViewById(R.id.refreshRegistration)).setEnabled(false);
    }

    if (mAlohar.isServiceRunning()) {
        //findViewById(R.id.timeFilterSpinner).setClickable(true);
        mDistanceFilterSpinner.setEnabled(true);
    } else {
        //findViewById(R.id.timeFilterSpinner).setClickable(false);
        mDistanceFilterSpinner.setEnabled(false);
    }

    String tableStatus = mPrefs.getString(PREF_TABLE_STATUS, null);
    if (tableStatus == null) {
        tableStatus = getString(R.string.geolocationStatusRegRequired);
        //Setup interface
        //Done in XML file
    } else {
        //setup interface
        if (tableStatus.equals(getString(R.string.geolocationAnonymizePending))) {
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setTextColor(getResources().getColor(R.color.text_orange));
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setText(getString(R.string.geolocationAnonymizePending));

            ((Button) findViewById(R.id.registerAnonymize)).setVisibility(View.GONE);
            ((Button) findViewById(R.id.checkAnonymize)).setVisibility(View.VISIBLE);
        } else if (tableStatus.equals(getString(R.string.geolocationAnonymizeProcessed))) {
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setTextColor(getResources().getColor(R.color.text_green));
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setText(getString(R.string.geolocationAnonymizeProcessed));

            ((Button) findViewById(R.id.checkAnonymize)).setVisibility(View.GONE);
            ((Button) findViewById(R.id.registerAnonymize)).setVisibility(View.GONE);
            ((Button) findViewById(R.id.logWithGoogle)).setVisibility(View.GONE);
            ((Button) findViewById(R.id.toggleGeolocation)).setVisibility(View.VISIBLE);
            findViewById(R.id.geolocationServiceStatus).setVisibility(View.VISIBLE);
            findViewById(R.id.myDataCheckbox).setEnabled(true);
        } else if (tableStatus.equals(getString(R.string.geolocationStatusRegStart))) {
            findViewById(R.id.logWithGoogle).setVisibility(View.GONE);
            findViewById(R.id.registerAnonymize).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setTextColor(getResources().getColor(R.color.text_orange));
            ((TextView) findViewById(R.id.geolocationStatus))
                    .setText(getString(R.string.geolocationStatusRegStart));
        }
    }

    ((TextView) findViewById(R.id.tableStatus)).setText(tableStatus);

    if (mAloharUid != null) {
        mUIDView.setText(String.valueOf(mAloharUid));
        onAuthenClick(mUIDView);
    } else {
        mAloharAuthLayout.setVisibility(View.VISIBLE);
    }

    mGOOGCredential = new GoogleCredential.Builder().setTransport(mNetHttpTransport)
            .setJsonFactory(mJaksonJSONFactory)//.build();
            .setClientSecrets(OAuth2ClientCredentials.CLIENT_ID, OAuth2ClientCredentials.CLIENT_SECRET).build();

    mGOOGCredential.setAccessToken(null);
    mGOOGCredential.setRefreshToken(mPrefs.getString(PREF_REFRESH_TOKEN, null));

    //Logger.getLogger("com.google.api.client").setLevel(LOGGING_LEVEL);

    Builder truc = GoogleClient.builder(mNetHttpTransport, mJaksonJSONFactory, new GenericUrl(SERVICE_URL));
    truc.setHttpRequestInitializer(mGOOGCredential);

    mGOOGClient = truc.build();

    mPollFrequencyText = (TextView) findViewById(R.id.pollFrequencyText);
    mPollFrequencyText.setText("N/A when stationary");
    //Something is wrong with the color, I'll see that cosmetic side later
    //mPollFrequencyText.setTextColor(R.color.text_violet);

    mLocationPollThreadExecutor.setKeepAliveTime(0, TimeUnit.SECONDS);

    RadioGroup pollFrequencyRadioGroup = (RadioGroup) findViewById(R.id.pollFrequencyRadioGroup);

    pollFrequencyRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {

            cancelActiveTasks();
            startTaskForId(checkedId, true);
        }
    });

    findViewById(R.id.frequency0).setEnabled(false);
    findViewById(R.id.frequency1).setEnabled(false);
    findViewById(R.id.frequency2).setEnabled(false);
    findViewById(R.id.frequency3).setEnabled(false);

}