List of usage examples for android.view.animation Animation REVERSE
int REVERSE
To view the source code for android.view.animation Animation REVERSE.
Click Source Link
From source file:com.carver.paul.truesight.Ui.MainActivity.java
/** * Makes the camera pulse infinitely (will be stopped when loading completes) */// w w w .j a v a 2 s .c o m //TODO-nextversion: Make camera do something other than pulse - it implies you should press // it! private void pulseCameraImage() { //Code using the old Animation class, rather than the new ViewPropertyAnimator //Infinite repeat is easier to implement this way View cameraImage = findViewById(R.id.image_pulsing_camera); cameraImage.setVisibility(View.VISIBLE); cameraImage.setAlpha(1f); ScaleAnimation pulse = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); pulse.setDuration(250); pulse.setRepeatCount(Animation.INFINITE); pulse.setRepeatMode(Animation.REVERSE); cameraImage.startAnimation(pulse); View processingText = findViewById(R.id.text_processing_image); processingText.setAlpha(1f); processingText.setVisibility(View.VISIBLE); }
From source file:com.kunze.androidlocaltodo.TaskActivityFragment.java
@Override public void SwipedWhileDisabled() { AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); animation.setDuration(50);/*from w w w. ja v a 2 s . co m*/ animation.setRepeatCount(5); animation.setRepeatMode(Animation.REVERSE); Button revertButton = (Button) getView().findViewById(R.id.revert_button); Button acceptButton = (Button) getView().findViewById(R.id.accept_button); revertButton.startAnimation(animation); acceptButton.startAnimation(animation); }
From source file:com.guardtrax.ui.screens.HomeScreen.java
public void onCreate(Bundle savedInstanceState) { ctx = this.getApplicationContext(); super.onCreate(savedInstanceState); //restore saved instances if necessary if (savedInstanceState != null) { Toast.makeText(HomeScreen.this, savedInstanceState.getString("message"), Toast.LENGTH_LONG).show(); GTConstants.darfileName = savedInstanceState.getString("darfileName"); GTConstants.tarfileName = savedInstanceState.getString("tarfileName"); GTConstants.trpfilename = savedInstanceState.getString("trpfilename"); GTConstants.srpfileName = savedInstanceState.getString("srpfileName"); Utility.setcurrentState(savedInstanceState.getString("currentState")); Utility.setsessionStart(savedInstanceState.getString("getsessionStart")); selectedCode = savedInstanceState.getString("selectedCode"); lunchTime = savedInstanceState.getString("lunchTime"); breakTime = savedInstanceState.getString("breakTime"); signaturefileName = savedInstanceState.getString("signaturefileName"); GTConstants.tourName = savedInstanceState.getString("tourName"); tourTime = savedInstanceState.getString("tourTime"); tourEnd = savedInstanceState.getLong("tourEnd"); lunchoutLocation = savedInstanceState.getInt("lunchoutLocation"); breakoutLocation = savedInstanceState.getInt("breakoutLocation"); touritemNumber = savedInstanceState.getInt("touritemNumber"); chekUpdate = savedInstanceState.getBoolean("chekUpdate"); GTConstants.sendData = savedInstanceState.getBoolean("send_data"); GTConstants.isTour = savedInstanceState.getBoolean("isTour"); GTConstants.isGeoFence = savedInstanceState.getBoolean("isGeoFence"); } else {//from ww w. jav a2 s . c om //set the current state Utility.setcurrentState(GTConstants.offShift); //set the default startup code to start shift selectedCode = "start_shift"; } /* //Determine screen size if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show(); } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { Toast.makeText(this, "Normal sized screen" , Toast.LENGTH_LONG).show(); } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) { Toast.makeText(this, "Small sized screen" , Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show(); } //initialize receiver to monitor for screen on / off /* IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); BroadcastReceiver mReceiver = new ScreenReceiver(); registerReceiver(mReceiver, filter); */ setContentView(R.layout.homescreen); //Create object to call the Database class myDatabase = new GuardTraxDB(this); preferenceDB = new PreferenceDB(this); ftpdatabase = new ftpDataBase(this); gtDB = new GTParams(this); aDB = new accountsDB(this); trafficDB = new trafficDataBase(this); tourDB = new tourDataBase(this); //check for updates if (chekUpdate) { //reset the preference value chekUpdate = false; //check for application updates checkUpdate(); } //initialize the message timer //initializeOnModeTimerEvent(); //get the version number and set it in constants String version_num = ""; PackageManager manager = this.getPackageManager(); try { PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0); version_num = info.versionName.toString(); } catch (NameNotFoundException e) { version_num = "0.00.00"; } GTConstants.version = version_num; //final TextView version = (TextView) findViewById(R.id.textVersion); //version.setText(version_num); //set up the animation animation.setDuration(500); // duration - half a second animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in buttonClick.setDuration(50); // duration - half a second buttonClick.setInterpolator(new LinearInterpolator()); // do not alter animation rate buttonClick.setRepeatCount(1); // Repeat animation once buttonClick.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in textWarning = (TextView) findViewById(R.id.txtWarning); textWarning.setWidth(500); textWarning.setGravity(Gravity.CENTER); //allow the text to be clicked if necessary textWarning.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (GTConstants.isTour && GTConstants.tourName.length() > 1) displaytourInfo(); } }); //goto scan page button btn_scan_screen = (Button) findViewById(R.id.btn_goto_scan); btn_scan_screen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_scan_screen.startAnimation(buttonClick); //Utility.showScan(HomeScreen.this); scan_click(false); } }); //goto report page button btn_report_screen = (Button) findViewById(R.id.btn_goto_report); btn_report_screen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_report_screen.startAnimation(buttonClick); report_click(); } }); //goto dial page button btn_dial_screen = (Button) findViewById(R.id.btn_goto_dial); btn_dial_screen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_dial_screen.startAnimation(buttonClick); dial_click(); } }); //microphone button btn_mic = (Button) findViewById(R.id.btn_mic); btn_mic.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_mic.startAnimation(buttonClick); voice_click(); } }); //camera button btn_camera = (Button) findViewById(R.id.btn_camera); btn_camera.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_camera.startAnimation(buttonClick); camera_click(); } }); //video button btn_video = (Button) findViewById(R.id.btn_video); btn_video.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btn_video.startAnimation(buttonClick); video_click(); } }); // Register a callback to be invoked when this view is clicked. If this view is not clickable, it becomes clickable. btn_send = (Button) findViewById(R.id.btn_Send); btn_send.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //prevent multiple fast clicking if (SystemClock.elapsedRealtime() - mLastClickTime < 2000) return; mLastClickTime = SystemClock.elapsedRealtime(); incidentcodeSent = true; btn_send.startAnimation(buttonClick); //if start shift has not been sent then the device is in do not send data mode. Warn the user if (Utility.getcurrentState().equals(GTConstants.offShift) && !selectedCode.equals("start_shift")) { show_alert_title = "Error"; show_alert_message = "You must start your shift!"; showAlert(show_alert_title, show_alert_message, true); //set spinner back to start shift spinner.setSelection(0); } else { if (Utility.deviceRegistered()) { show_alert_title = "Success"; show_alert_message = "Action success"; } else { show_alert_title = "Warning"; show_alert_message = "You are NOT registered!"; showAlert(show_alert_title, show_alert_message, true); } if (selectedCode.equals("start_shift")) { //if shift already started if (Utility.getcurrentState().equals(GTConstants.onShift)) { show_alert_title = "Warning"; show_alert_message = "You must end shift!"; showAlert(show_alert_title, show_alert_message, true); //set spinner back to all clear spinner.setSelection(2); } else { ToastMessage.displayToastFromResource(HomeScreen.this, 5, Gravity.CENTER, (ViewGroup) findViewById(R.id.toast_layout_root)); pdialog = ProgressDialog.show(HomeScreen.this, "Please wait", "Starting shift ...", true); //set the current state Utility.setcurrentState(GTConstants.onShift); setuserBanner(); //wait for start shift actions to complete (or timeout occurs) before dismissing wait dialog new CountDownTimer(5000, 1000) { @Override public void onTick(long millisUntilFinished) { if (start_shift_wait) pdialog.dismiss(); } @Override public void onFinish() { if (!(pdialog == null)) pdialog.dismiss(); } }.start(); //create dar file try { //create the dar file name GTConstants.darfileName = GTConstants.LICENSE_ID.substring(7) + "_" + Utility.getUTCDate() + "_" + Utility.getUTCTime() + ".dar"; //write the version to the dar file Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.darfileName, "Version;" + GTConstants.version + "\r\n", false); //write the start shift event to the dar file Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.darfileName, "Start shift;" + GTConstants.currentBatteryPercent + ";" + Utility.getLocalTime() + ";" + Utility.getLocalDate() + "\r\n", true); //create the tar file name if module installed if (GTConstants.isTimeandAttendance) { GTConstants.tarfileName = GTConstants.LICENSE_ID.substring(7) + "_" + Utility.getUTCDate() + "_" + Utility.getUTCTime() + ".tar"; //write the start shift event to the tar file Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.tarfileName, "Name;" + GTConstants.report_name + "\r\n" + "Start shift;" + Utility.getLocalTime() + ";" + Utility.getLocalDate() + "\r\n", false); } } catch (Exception e) { Toast.makeText(HomeScreen.this, "error = " + e, Toast.LENGTH_LONG).show(); } GTConstants.sendData = true; //if not time and attendance then send start shift event now, otherwise wait till after location scan send_event("11"); //set the session start time SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yy HH:mm:ss"); Utility.setsessionStart(sdf.format(new Date())); //reset the server connection flag Utility.resetisConnecting(); //start the GPS location service MainService.openLocationListener(); //set spinner back to all clear spinner.setSelection(2); setwarningText(""); if (GTConstants.isTimeandAttendance) { show_taa_scan(true, false); } } } else if (selectedCode.equals("end_shift")) { if (!Utility.getcurrentState().equals(GTConstants.onShift) && GTConstants.isTimeandAttendance) { show_alert_title = "Error"; show_alert_message = "You must end your Lunch / Break!"; showAlert(show_alert_title, show_alert_message, true); //set spinner back to start shift spinner.setSelection(2); } else { btn_send.setEnabled(false); if (GTConstants.isTimeandAttendance) { show_taa_scan(false, true); } else endshiftCode(); } } else { if (Utility.isselectionValid(HomeScreen.this, selectedCode)) { //if time and attendance then write to file if (selectedCode.equalsIgnoreCase(GTConstants.lunchin) || selectedCode.equalsIgnoreCase(GTConstants.lunchout) || selectedCode.equalsIgnoreCase(GTConstants.startbreak) || selectedCode.equalsIgnoreCase(GTConstants.endbreak)) { if (GTConstants.isTimeandAttendance) Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.tarfileName, spinner.getSelectedItem().toString() + ";" + Utility.getLocalTime() + ";" + Utility.getLocalDate() + "\r\n", true); if (selectedCode.equalsIgnoreCase(GTConstants.lunchin)) { Utility.setcurrentState(GTConstants.onLunch); Utility.setlunchStart(true); setuserBanner(); } if (selectedCode.equalsIgnoreCase(GTConstants.startbreak)) { Utility.setcurrentState(GTConstants.onBreak); Utility.setbreakStart(true); setuserBanner(); } if (selectedCode.equalsIgnoreCase(GTConstants.lunchout)) { Utility.setcurrentState(GTConstants.onShift); lunchTime = Utility.gettimeDiff(Utility.getlunchStart(), Utility.getLocalDateTime()); setuserBanner(); } if (selectedCode.equalsIgnoreCase(GTConstants.endbreak)) { Utility.setcurrentState(GTConstants.onShift); breakTime = Utility.gettimeDiff(Utility.getbreakStart(), Utility.getLocalDateTime()); setuserBanner(); } } ToastMessage.displayToastFromResource(HomeScreen.this, 5, Gravity.CENTER, (ViewGroup) findViewById(R.id.toast_layout_root)); //save the event description as may be needed for incident report incidentDescription = spinner.getSelectedItem().toString(); //write to dar Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.darfileName, "Event; " + incidentDescription + ";" + Utility.getLocalTime() + ";" + Utility.getLocalDate() + "\r\n", true); //write to srp if (GTConstants.srpfileName.length() > 1) Utility.write_to_file(HomeScreen.this, GTConstants.dardestinationFolder + GTConstants.srpfileName, "Event; " + incidentDescription + ";" + Utility.getLocalTime() + ";" + Utility.getLocalDate() + "\r\n", true); //send the data send_event(selectedCode); //ask if user wants to create an incident report. If the last character is a space, that indicates not to ask for report if (!(incidentDescription.charAt(incidentDescription.length() - 1) == ' ') && !trafficIncident) showYesNoAlert("Report", "Create an Incident Report?", incidentreportScreen); if (!(incidentDescription.charAt(incidentDescription.length() - 1) == ' ') && trafficIncident) showYesNoAlert("Report", "Create a Traffic Violation?", incidentreportScreen); //if last two characters are spaces then ask to write a note if (incidentDescription.charAt(incidentDescription.length() - 1) == ' ' && incidentDescription.charAt(incidentDescription.length() - 2) == ' ') showYesNoAlert("Report", "Create a Note?", createNote); } //set spinner back to required state if (selectedCode.equalsIgnoreCase(GTConstants.lunchin)) spinner.setSelection(lunchoutLocation); else if (selectedCode.equalsIgnoreCase(GTConstants.startbreak)) spinner.setSelection(breakoutLocation); else spinner.setSelection(2); } } } }); //Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle). spinner = (Spinner) findViewById(R.id.spinner_list); //method initialize the spinner action initializeSpinnerControl(); if (GTConstants.service_intent == null) { //Condition to check whether the Database exist and if so load data into constants try { if (preferenceDB.checkDataBase()) { preferenceDB.open(); Cursor cursor = preferenceDB.getRecordByRowID("1"); preferenceDB.close(); if (cursor == null) loadPreferenceDataBase(); else { saveInConstants(cursor); cursor.close(); } syncDB(); syncFTP(); syncftpUpload(); } else { preferenceDB.open(); preferenceDB.close(); //Toast.makeText(HomeScreen.this, "Path = " + preferenceDB.get_path(), Toast.LENGTH_LONG).show(); //Toast.makeText(HomeScreen.this, "No database found", Toast.LENGTH_LONG).show(); loadPreferenceDataBase(); syncDB(); syncFTP(); syncftpUpload(); } } catch (Exception e) { preferenceDB.createDataBase(); loadPreferenceDataBase(); Toast.makeText(HomeScreen.this, "Creating database", Toast.LENGTH_LONG).show(); } //setup the auxiliary databases if (!aDB.checkDataBase()) { aDB.open(); aDB.close(); } if (!ftpdatabase.checkDataBase()) { ftpdatabase.open(); ftpdatabase.close(); } if (!gtDB.checkDataBase()) { gtDB.open(); gtDB.close(); } if (!trafficDB.checkDataBase()) { trafficDB.open(); trafficDB.close(); } if (!tourDB.checkDataBase()) { tourDB.open(); tourDB.close(); } //get the parameters from the parameter database loadGTParams(); //this code starts the main service running which contains all the event timers if (Utility.deviceRegistered()) { //this is the application started event - sent once when application starts up if (savedInstanceState == null) send_event("PU"); initService(); } } //if device not registered than go straight to scan screen if (!Utility.deviceRegistered()) { newRegistration = true; //send_data = true; scan_click(false); } //setup the user banner setuserBanner(); //set the warning text setwarningText(""); }
From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java
public Animation getBlinkAnimation() { Animation animation = new AlphaAnimation(1, 0); animation.setDuration(600);/*from ww w. ja v a 2 s .c o m*/ animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(1); animation.setRepeatMode(Animation.REVERSE); return animation; }
From source file:de.grobox.liberario.DirectionsFragment.java
private void pressGpsButton() { List<String> providers = locationManager.getProviders(true); for (String provider : providers) { // Register the listener with the Location Manager to receive location updates locationManager.requestSingleUpdate(provider, this, null); Log.d(getClass().getSimpleName(), "Register provider for location updates: " + provider); }//from w w w . j a v a 2 s.c o m // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { removeUpdates(); Toast.makeText(getActivity(), getResources().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); return; } // show GPS button blinking final Animation animation = new AlphaAnimation(1, 0); animation.setDuration(500); animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); mView.findViewById(R.id.fromStatusButton).setAnimation(animation); mGpsPressed = true; gps_loc = null; }
From source file:com.adityarathi.muo.ui.activities.NowPlayingActivity.java
/** * Initiates the strobe effect on the seekbar. *///from w w w . j a v a 2 s .c o m private void initSeekbarStrobeEffect() { mSeekbarStrobeAnim = new AlphaAnimation(1.0f, 0.0f); mSeekbarStrobeAnim.setRepeatCount(SEEKBAR_STROBE_ANIM_REPEAT); mSeekbarStrobeAnim.setDuration(700); mSeekbarStrobeAnim.setRepeatMode(Animation.REVERSE); mSeekbar.startAnimation(mSeekbarStrobeAnim); }