Android Open Source - android-play-api-client Global






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;
/*ww w  .j  a  v  a2 s  . co m*/
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

import ar.com.gmvsoft.play.api.dto.ProductDTO;

public class Global {

  private static Global instance;

  private List<String> urlList = new LinkedList<String>(Arrays.asList("https://products-api-gvolpe.herokuapp.com", 
      "http://192.168.1.12:9000", "http://10.155.8.90:9000"));
  private String apiUrl = "http://localhost:9000";
  private Boolean shakeIt = Boolean.FALSE;
  private List<ProductDTO> products;
  private ProductDTO productById;

  private Global() {
  }

  public String getApiUrl() {
    return apiUrl;
  }

  public void setApiUrl(String apiUrl) {
    this.apiUrl = apiUrl;
  }
  
  public void setApiUrlAndUpdateList(String apiUrl) {
    this.apiUrl = apiUrl;
    int selectedIndex = urlList.indexOf(apiUrl);
    urlList.remove(selectedIndex);
    urlList.add(0, apiUrl);
  }

  public static synchronized Global instance() {
    if (instance == null) {
      instance = new Global();
    }
    return instance;
  }

  public List<String> getUrlList() {
    return urlList;
  }

  public Boolean getShakeIt() {
    return shakeIt;
  }

  public void setShakeIt(Boolean shakeIt) {
    this.shakeIt = shakeIt;
  }

  public List<ProductDTO> getProducts() {
    return products;
  }

  public void setProducts(List<ProductDTO> products) {
    this.products = products;
  }
  
  public Boolean existProducts() {
    return products != null;
  }

  public ProductDTO getProductById() {
    return productById;
  }

  public void setProductById(ProductDTO productById) {
    this.productById = productById;
  }
  
  public Boolean existProductById() {
    return productById != null;
  }
  
}




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