Esempio n. 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.learndigits);
    try {

      toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);

      SharedPreferences pref = getSharedPreferences("ASL", Context.MODE_PRIVATE);
      CommonThings.PAID_APP = pref.getString("PAID", "temp");
      if (CommonThings.PAID_APP.equalsIgnoreCase("temp")) {

        AdView adView = (AdView) this.findViewById(R.id.adView);
        AdRequest adRequest =
            new AdRequest.Builder().addTestDevice("A38A51D43110AAD81A8E3AE3AC468C32").build();
        adView.loadAd(adRequest);

        // Interstitials ad

        interstitialAd = new InterstitialAd(this);
        interstitialAd.setAdUnitId(getResources().getString(R.string.interstitialid));
        interstitialAd.loadAd(adRequest);
        interstitialAd.setAdListener(
            new AdListener() {
              @Override
              public void onAdLoaded() {
                // TODO Auto-generated method stub
                DisplayAd();
              }
            });
      }

      //

      btn_nex = (ImageButton) findViewById(R.id.btnForward);
      btn_back = (ImageButton) findViewById(R.id.btnBackward);
      btn_last = (ImageButton) findViewById(R.id.btnNext);
      btn_first = (ImageButton) findViewById(R.id.btnPrevious);
      imageView1 = (ImageView) findViewById(R.id.imageView1);
      tv_hotvines = (TextView) findViewById(R.id.tv_hotvines);
      animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.right_out);

      mp = MediaPlayer.create(this, sounds[curr]);
      mp.start();

      btn_nex.setOnClickListener(this);
      btn_back.setOnClickListener(this);
      btn_first.setOnClickListener(this);
      btn_last.setOnClickListener(this);
      tv_hotvines.setOnClickListener(this);
    } catch (Exception ex) {
      DebugLog.console(ex, "Learn_Digits onCreate Exception");
    }
  }
Esempio n. 2
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    try {
      switch (v.getId()) {
        case R.id.btnForward:
          if (curr < 25 && curr >= 0) {
            curr++;
            imageView1.setImageResource(images[curr]);
            mp = MediaPlayer.create(this, sounds[curr]);
            mp.start();
            //				text_des.setText("Make a fist and then move your thumb over to the side of your
            // hand");
            imageView1.startAnimation(animationFadeIn);

          } else {
            Toast.makeText(getApplicationContext(), "Z is the last word", Toast.LENGTH_SHORT)
                .show();
          }
          break;

        case R.id.btnBackward:
          if (curr > 0) {
            curr--;
            imageView1.setImageResource(images[curr]);
            mp = MediaPlayer.create(this, sounds[curr]);
            mp.start();
            //				text_des.setText("Tip:Make a fist and then move your thumb over to the side of
            // your hand");
            imageView1.startAnimation(animationFadeIn);

          } else {
            Toast.makeText(getApplicationContext(), "A is the first word", Toast.LENGTH_SHORT)
                .show();
          }
          break;
        case R.id.btnNext:
          curr = images.length - 1;
          imageView1.setImageResource(images[curr]);
          mp = MediaPlayer.create(this, sounds[curr]);
          mp.start();
          //			text_des.setText("Tip:Make a fist and then move your thumb over to the side of your
          // hand");
          imageView1.startAnimation(animationFadeIn);
          break;
        case R.id.btnPrevious:
          curr = 0;
          imageView1.setImageResource(images[curr]);
          mp = MediaPlayer.create(this, sounds[curr]);
          mp.start();
          //			text_des.setText("Tip:Make a fist and then move your thumb over to the side of your
          // hand");
          imageView1.startAnimation(animationFadeIn);
          break;
        case R.id.tv_hotvines:
          final String appPackageName =
              "pious.bestvines"; // getPackageName() from Context or Activity object
          try {

            startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
          } catch (android.content.ActivityNotFoundException anfe) {
            startActivity(
                new Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
          }

          break;

        default:
          break;
      }
    } catch (Exception ex) {
      DebugLog.console(ex, "LearnAlphabets onclick Exception");
    }
  }