Android Open Source - android-play-api-client Debug Options Activity






From Project

Back to project page android-play-api-client.

License

The source code is released under:

Apache License

If you think the Android project android-play-api-client 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 ar.com.gmvsoft.play.ui;
//from w ww  . j a v a2s .c  om
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import ar.com.gmvsoft.play.Global;
import ar.com.gmvsoft.play.R;

@EActivity(R.layout.activity_debug_options)
public class DebugOptionsActivity extends Activity {

  private ArrayAdapter<String> urlAdapter;

  @ViewById
  EditText txtCustomUrl;
  
  @ViewById
  RadioButton radioUrlSubtitle;
  
  @ViewById
  RadioButton radioCustomUrl;
  
  @ViewById
  Spinner spinnerUrls;

  @AfterViews
  void setUp() {
    Global.instance().setShakeIt(false);
    createSpinnerUrls();
    
    radioUrlSubtitle.setChecked(true);
    txtCustomUrl.setEnabled(false);
    
    createRadioButtonListeners();
  }

  @Click
  void btnOkClicked() {
    String selectedUrl = txtCustomUrl.getText().toString().trim();
    Global.instance().setApiUrl(selectedUrl);
    
    if (selectedUrl == null || selectedUrl.isEmpty()) {
      selectedUrl = (String) spinnerUrls.getSelectedItem();
      Global.instance().setApiUrlAndUpdateList(selectedUrl);
    }
    
    Intent main = new Intent(this, MainActivity_.class);
    startActivity(main);
  }

  private void createSpinnerUrls() {
    urlAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Global.instance()
        .getUrlList());
    urlAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerUrls.setAdapter(urlAdapter);
  }

  private void createRadioButtonListeners() {
    radioCustomUrl.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        radioUrlSubtitle.setChecked(false);
        spinnerUrls.setEnabled(false);
        txtCustomUrl.setEnabled(true);
      }
      
    });
    
    radioUrlSubtitle.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        radioCustomUrl.setChecked(false);
        txtCustomUrl.setEnabled(false);
        spinnerUrls.setEnabled(true);
      }
      
    });
  }
  
}




Java Source Code List

ar.com.gmvsoft.play.Global.java
ar.com.gmvsoft.play.api.ProductsResource.java
ar.com.gmvsoft.play.api.dto.BaseProductDTO.java
ar.com.gmvsoft.play.api.dto.ProductDTO.java
ar.com.gmvsoft.play.api.error.APIErrorHandler.java
ar.com.gmvsoft.play.hardware.ShakeSensorListener.java
ar.com.gmvsoft.play.ui.DebugOptionsActivity.java
ar.com.gmvsoft.play.ui.MainActivity.java
ar.com.gmvsoft.play.ui.adapter.ProductsListAdapter.java
ar.com.gmvsoft.play.ui.adapter.ProductsTabsPagerAdapter.java
ar.com.gmvsoft.play.ui.dialog.DialogHelper.java
ar.com.gmvsoft.play.ui.fragment.AddNewFragment.java
ar.com.gmvsoft.play.ui.fragment.FindAllFragment.java
ar.com.gmvsoft.play.ui.fragment.FindByIdFragment.java