Example #1
0
  private void init() {
    try {
      // --
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inSampleSize = 2; // ͼƬѹËõ±¶Êý
      bitmap_logo = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher, options);

      // --
      animation_show_logo = new AlphaAnimation(0.0f, 1.0f);
      animation_show_logo.setDuration(5000);
      animation_show_logo.setAnimationListener(new listener_activity_logo_animation(handler));
      // --
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(200, 200);
      cmd_imageview_logo_container =
          (ImageView) findViewById(R.id.activity_logo_imageview_logo_container);
      cmd_imageview_logo_container.setLayoutParams(params);
      cmd_imageview_logo_container.setImageBitmap(bitmap_logo);
      cmd_imageview_logo_container.setAnimation(animation_show_logo);
      // --
      cmd_textview_app_version = (TextView) findViewById(R.id.activity_logo_textview_app_version);
      cmd_textview_app_version.setText("ÕÆÉÏ°®±¦±´V2.0");
      cmd_textview_app_version.setTextSize(20);
      cmd_textview_app_version.setTextColor(Color.GREEN);
      cmd_textview_app_version.setAnimation(animation_show_logo);
      // --

    } catch (Exception e) {
      // TODO: handle exception
    }
  }
Example #2
0
  public void loadAnimation() {
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_in_right_delay);
    Animation animation2 = AnimationUtils.loadAnimation(this, R.anim.slide_in_right_delay);
    Animation animation3 = AnimationUtils.loadAnimation(this, R.anim.slide_in_right_delay);
    Animation fadeAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in);
    overLay.setAnimation(animation);
    overLay2.setAnimation(animation2);
    overLay3.setAnimation(animation3);
    welcomeText.setAnimation(fadeAnimation);

    animation3.setStartOffset(500);
    animation2.setStartOffset(600);
    animation.setStartOffset(700);
    fadeAnimation.setStartOffset(1000);
    welcomeText.setVisibility(View.VISIBLE);

    fadeAnimation.setAnimationListener(
        new Animation.AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            // searchNewMessages();

            loadOut();
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}
        });

    //

  }
Example #3
0
  private void fadeOutBadge(final Runnable onAnimationComplete) {
    synchronized (lock) {
      if (!animationRunning // animation is already running, so shouldn't
          // start a new one
          && lastIncremented.get() != 0 // counter was reset, in which
          // case it would be
          // unintuitive for the badge
          // to fade
          && badgeTextView.getVisibility() == View.VISIBLE) {
        // animation isn't already showing, and the badge is visible
        animationRunning = true;

        badgeLinearLayout.setVisibility(View.VISIBLE);
        // show an animation for the badge with the textview and the
        // background linearlayout fading out
        Animation fadeOutAnimation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
        fadeOutAnimation.setDuration(ANIMATION_TIME);
        fadeOutAnimation.setAnimationListener(
            new AnimationListener() {

              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationRepeat(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                synchronized (lock) {
                  badgeTextView.setVisibility(View.INVISIBLE);

                  // necessary to update again to set the history text
                  // view correctly
                  onAnimationComplete.run();
                  animationRunning = false;
                }
              }
            });
        badgeTextView.setAnimation(fadeOutAnimation);
        fadeOutAnimation.start();
        TransitionDrawable transitionDrawable =
            (TransitionDrawable) badgeLinearLayout.getBackground();
        transitionDrawable.setCrossFadeEnabled(true);
        transitionDrawable.startTransition(ANIMATION_TIME);
      } else {
        // just don't show it - the animation might already be showing,
        // or maybe the badge is
        // already invisible
        badgeLinearLayout.setVisibility(View.INVISIBLE);
        badgeTextView.setVisibility(View.INVISIBLE);

        // this ensures that the history text view gets updated
        // properly, even if the user
        // exits the activity while the animation is in progress (e.g.
        // by going to the Settings)
        onAnimationComplete.run();
      }
    }
  }
 public void animateRegion() {
   if (regionIV != null) {
     Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in);
     regionIV.setAnimation(anim);
     regionTV.setAnimation(anim);
     anim.setStartOffset(1500);
     anim.setFillAfter(true);
     anim.start();
   }
 }
  /** * Fetching user's information name, email, profile pic * */
  private void getProfileInformation() {
    try {
      if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
        Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
        String personName = currentPerson.getDisplayName();
        String personPhotoUrl = currentPerson.getImage().getUrl();
        String personGooglePlusProfile = currentPerson.getUrl();
        String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
        Log.e(
            TAG,
            "Name: "
                + personName
                + ", plusProfile: "
                + personGooglePlusProfile
                + ", email: "
                + email
                + ", Image: "
                + personPhotoUrl);

        Toast.makeText(
                getApplicationContext(),
                "Signed In as:" + currentPerson.getDisplayName(),
                Toast.LENGTH_LONG)
            .show();
        if (!sharedPref.contains("UID")) {
          int Applicationid = getUID();
          saveSharedint("UID", Applicationid);
        }

        long DS = getDataValue(context);
        long DC = getFolderSize() + DS;
        String DataS = l2bytes(DS, false);
        String DataC = l2bytes(DC, false);

        long hours = CommonUtils.totaltime / 3600;
        long minutes = (CommonUtils.totaltime % 3600) / 60;
        long seconds = (long) ((CommonUtils.totaltime % 3600) % 60);

        txtDatasent.setText("Data Sent :" + DataS);
        txtDatasent.setAnimation(null);

      } else {
        Toast.makeText(getApplicationContext(), "Person information is null", Toast.LENGTH_LONG)
            .show();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #6
0
  public void loadOut() {
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_delay);
    Animation animation2 = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_delay);
    Animation animation3 = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_delay);
    Animation fadeAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
    overLay.clearAnimation();
    overLay.setAnimation(animation);
    overLay2.clearAnimation();
    overLay2.setAnimation(animation2);
    overLay3.clearAnimation();
    overLay3.setAnimation(animation3);
    welcomeText.clearAnimation();
    welcomeText.setAnimation(fadeAnimation);

    fadeAnimation.setStartOffset(1500);
    animation.setStartOffset(2000);
    animation2.setStartOffset(2100);
    animation3.setStartOffset(2200);

    welcomeText.setVisibility(View.GONE);
    overLay.setVisibility(View.GONE);
    overLay2.setVisibility(View.GONE);
    overLay3.setVisibility(View.GONE);

    animation3.setAnimationListener(
        new Animation.AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {

            dashBoard();
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}
        });
  }
Example #7
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.shops_main);

    lives = (TextView) findViewById(R.id.live_things);
    students = (TextView) findViewById(R.id.stud_things);
    books = (TextView) findViewById(R.id.books);
    electrictys = (TextView) findViewById(R.id.el_things);
    accessoriess = (TextView) findViewById(R.id.accessories_things);

    rotate = AnimationUtils.loadAnimation(shopsActivity.this, R.anim.rotate);
    alpha = AnimationUtils.loadAnimation(shopsActivity.this, R.anim.alpha);
    books.setAnimation(rotate);
    lives.setAnimation(alpha);
    students.setAnimation(alpha);
    electrictys.setAnimation(alpha);
    accessoriess.setAnimation(alpha);
    rotate.setAnimationListener(
        new AnimationListener() {

          public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            books.clearAnimation();
            lives.clearAnimation();
            students.clearAnimation();
            electrictys.clearAnimation();
            accessoriess.clearAnimation();
          }

          public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

          }

          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

          }
        });

    lives.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                lives.setBackgroundColor(Color.argb(155, 0, 255, 0));
                break;
              case MotionEvent.ACTION_UP:
                lives.setBackgroundColor(Color.argb(255, 255, 127, 39));
                Intent intent = new Intent(shopsActivity.this, shoplives.class);
                startActivityForResult(intent, 0);
                break;
              default:
                break;
            }
            return true;
          }
        });

    students.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                students.setBackgroundColor(Color.argb(155, 0, 255, 0));
                break;
              case MotionEvent.ACTION_UP:
                students.setBackgroundColor(Color.argb(255, 255, 127, 39));
                Intent intent = new Intent(shopsActivity.this, shopstudys.class);
                startActivityForResult(intent, 1);
                break;
              default:
                break;
            }
            return true;
          }
        });

    books.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                books.setBackgroundColor(Color.argb(155, 0, 255, 0));
                break;
              case MotionEvent.ACTION_UP:
                books.setBackgroundColor(Color.argb(255, 255, 127, 39));
                Intent intent = new Intent(shopsActivity.this, shopbooks.class);
                startActivityForResult(intent, 2);
                break;
              default:
                break;
            }
            return true;
          }
        });

    electrictys.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                electrictys.setBackgroundColor(Color.argb(155, 0, 255, 0));
                break;
              case MotionEvent.ACTION_UP:
                electrictys.setBackgroundColor(Color.argb(255, 255, 127, 39));
                Intent intent = new Intent(shopsActivity.this, shopelectritys.class);
                startActivityForResult(intent, 3);
                break;
              default:
                break;
            }
            return true;
          }
        });

    accessoriess.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                accessoriess.setBackgroundColor(Color.argb(155, 0, 255, 0));
                break;
              case MotionEvent.ACTION_UP:
                accessoriess.setBackgroundColor(Color.argb(255, 255, 127, 39));
                Intent intent = new Intent(shopsActivity.this, shopaccessories.class);
                startActivityForResult(intent, 4);
                break;
              default:
                break;
            }
            return true;
          }
        });
  }
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.btn_launch_app:
        launchApp();
        break;

      case R.id.btn_sign_in:
        // Force File Upload
        if (internetConnectionCheck()) {
          Log.i(TAG, "sign in clicked to upload files");
          signInWithGplus();
          txtDatasent.setText("Signed In!");

          String FILE_UPL = "fileupload";
          Editor editor = sharedPref.edit();
          editor.putBoolean(FILE_UPL, true);
          editor.commit();

          try {
            timeBuf.close();
          } catch (IOException ie) {
            ie.printStackTrace();
          }

          CommonFunctions.CompressandSend();
          SensingController.unregisterAlarm(context.getApplicationContext());
          Log.i("File Upload Option:", "Zip Folder created!");

          final Runnable runnable =
              new Runnable() {
                public void run() {
                  // TODO Auto-generated method stub
                  {
                    try {
                      Thread.sleep(10000);
                    } catch (InterruptedException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                    }

                    Log.d(TAG, "Going to start File upload service");

                    String FILE_UPL = "fileupload";
                    Editor editor = sharedPref.edit();
                    editor.putBoolean(FILE_UPL, true);
                    editor.commit();
                    CommonFunctions.CompressandSend();
                    startFileUpload();
                  }
                }
              };

          new Thread(runnable).start();
          txtDatasent.setText("Uploading Data");
          txtDatasent.setAnimation(getBlinkAnimation());
          boolean valUpload = sharedPref.getBoolean("FILE_UPL", false);
          // txtDatasent.setText("Data Uploaded!");

          String text = txtDatasent.getText().toString();
          if (!valUpload && text.startsWith("Data Sent:")) {
            if (requestlogout()) {
              signOutFromGplus();
              Toast.makeText(getApplicationContext(), "Logged out!", Toast.LENGTH_LONG).show();
            }
            // launchRingDialog();
          }

        } else {
          Toast.makeText(getApplicationContext(), "Network Not available...", Toast.LENGTH_LONG)
              .show();
        }
        break;

      case R.id.btn_sign_out:
        // Signout button clicked
        exitApp();
        launchRingDialog();
        break;

        /*case R.id.btn_check_updates:
           // Checking for updates
           try{
               Intent viewIntent =
                       new Intent("android.intent.action.VIEW",
                               Uri.parse("https://play.google.com/store/apps/details?id=sense.routinenew"));
               startActivity(viewIntent);
           }

           catch(Exception e) {
               Toast.makeText(getApplicationContext(),"Unable to Connect Try Again...",
                       Toast.LENGTH_LONG).show();
               e.printStackTrace();
           }

           break;
        */

      case R.id.btn_note_on_time:
        long timeInMillis = System.currentTimeMillis();
        String newMsg = "Entry Time:" + CommonUtils.unixTimestampToString(timeInMillis);
        Toast.makeText(getApplicationContext(), "Entry time to be recorded!", Toast.LENGTH_LONG)
            .show();
        saveDataInFile(newMsg);

        break;

      case R.id.btn_note_off_time:
        long etimeInMillis = System.currentTimeMillis();
        String enewMsg = "Exit Time:" + CommonUtils.unixTimestampToString(etimeInMillis);
        Toast.makeText(getApplicationContext(), "Exit time to be recorded!", Toast.LENGTH_LONG)
            .show();
        saveDataInFile(enewMsg);

        break;

      case R.id.btn_entry_station:
        Intent entryIntent = new Intent(this, StationsList.class);
        entryIntent.putExtra("Travel Type", false);
        startActivity(entryIntent);

        break;

      case R.id.btn_exit_station:
        Intent exitIntent = new Intent(this, StationsList.class);
        exitIntent.putExtra("Travel Type", true);
        startActivity(exitIntent);

        break;
    }
  }
 private void animateAnswer() {
   AlphaAnimation fadeInAnimation = new AlphaAnimation(0, 1);
   fadeInAnimation.setDuration(1500);
   fadeInAnimation.setFillAfter(true);
   mAnswerLabel.setAnimation(fadeInAnimation);
 }