Exemplo n.º 1
0
 @Override
 protected void onStart() {
   super.onStart();
   gifView.play();
   LinearLayout back_promo = (LinearLayout) findViewById(R.id.back_promo);
   back_promo.setVisibility(View.VISIBLE);
 }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.promociones);

    bannerSlider = (ImageView) findViewById(R.id.bannerSliderPromo);

    gifView = (GifAnimado) findViewById(R.id.gifPromo);
    gifView.setGif(R.mipmap.gif_santog);
    gifView.play();

    btnLeftSlider = (ImageView) findViewById(R.id.btnLeftSliderPromo);
    btnLeftSlider.setClickable(true);
    btnLeftSlider.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (threadSlider != null) {
              threadSlider.interrupt();
              mueveSlider("izquierda");
            }
          }
        });

    btnRightSlider = (ImageView) findViewById(R.id.btnRightSliderPromo);
    btnRightSlider.setClickable(true);
    btnRightSlider.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (threadSlider != null) {
              threadSlider.interrupt();
              mueveSlider("derecha");
            }
          }
        });

    ImageView btnMenu = (ImageView) findViewById(R.id.atras_promociones);
    btnMenu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            try {
              finish();
            } catch (Throwable throwable) {
              throwable.printStackTrace();
            }
          }
        });

    ImageView btnFace = (ImageView) findViewById(R.id.btnFacebook);
    btnFace.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            sendToWeb("https://www.facebook.com/sto.gallo");
          }
        });

    ImageView btnTwitter = (ImageView) findViewById(R.id.btnTwitter);
    btnTwitter.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            sendToWeb("https://twitter.com/sto_gallo");
          }
        });

    TextView btnAviso = (TextView) findViewById(R.id.btnAviso);
    btnAviso.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(Promociones.this, AvisoPrivacidad.class);
            startActivity(intent);
          }
        });

    context = MenuActivity.getInstance();

    bannerSlider.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            ((MenuActivity) context).sendToWeb("http://www.santogallo.com/");
          }
        });

    if (((MenuActivity) context).isErrorBanners() || ((MenuActivity) context).isErrorConexion()) {
      gifView.stop();
      gifView.setVisibility(View.INVISIBLE);
      try {
        ((MenuActivity) context).getBanners();
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }
      obtenerBanners();
    } else if (((MenuActivity) context).getBanner(0) != null) {
      bannerSlider.setImageBitmap(((MenuActivity) context).getBanner(0));
      iniciaSlider();
    } else {
      obtenerBanners();
    }
  }