List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:id.zelory.tanipedia.activity.CuacaActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cuaca); toolbar = (Toolbar) findViewById(R.id.anim_toolbar); setSupportActionBar(toolbar);/* ww w .j a va 2 s .c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow); drawerLayout = (DrawerLayout) findViewById(R.id.nav_drawer); setUpNavDrawer(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); TextView nama = (TextView) navigationView.findViewById(R.id.nama); nama.setText(PrefUtils.ambilString(this, "nama")); TextView email = (TextView) navigationView.findViewById(R.id.email); email.setText(PrefUtils.ambilString(this, "email")); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { menuItem.setChecked(true); drawerLayout.closeDrawers(); Intent intent; switch (menuItem.getItemId()) { case R.id.cuaca: return true; case R.id.berita: intent = new Intent(CuacaActivity.this, BeritaActivity.class); break; case R.id.tanya: intent = new Intent(CuacaActivity.this, TanyaActivity.class); break; case R.id.harga: intent = new Intent(CuacaActivity.this, KomoditasActivity.class); break; case R.id.logout: PrefUtils.simpanString(CuacaActivity.this, "nama", null); intent = new Intent(CuacaActivity.this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); return true; case R.id.tentang: intent = new Intent(CuacaActivity.this, TentangActivity.class); startActivity(intent); return true; default: return true; } startActivity(intent); finish(); return true; } }); recyclerView = (RecyclerView) findViewById(R.id.scrollableview); recyclerView.setHasFixedSize(true); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(linearLayoutManager); fabButton = (FabButton) findViewById(R.id.determinate); fabButton.showProgress(true); fabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fabButton.showProgress(true); new DownloadData().execute(); } }); cuacaText = (TextView) findViewById(R.id.cuaca); suhu = (TextView) findViewById(R.id.suhu); minmax = (TextView) findViewById(R.id.minmax); iconCuaca = (ImageView) findViewById(R.id.icon_cuaca); kegiatan = (TextView) findViewById(R.id.kegiatan); background = (LinearLayout) findViewById(R.id.background); cuacaText.setVisibility(View.GONE); suhu.setVisibility(View.GONE); minmax.setVisibility(View.GONE); iconCuaca.setVisibility(View.GONE); kegiatan.setVisibility(View.GONE); if (checkPlayServices()) { buildGoogleApiClient(); } }
From source file:com.qiscus.sdk.ui.QiscusPhotoViewerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_qiscus_photo_viewer); toolbar = (Toolbar) findViewById(R.id.toolbar); tvTitle = (TextView) findViewById(R.id.tv_title); viewPager = (ViewPager) findViewById(R.id.view_pager); progressBar = (ProgressBar) findViewById(R.id.progress_bar); senderName = (TextView) findViewById(R.id.sender_name); date = (TextView) findViewById(R.id.date); ImageButton shareButton = (ImageButton) findViewById(R.id.action_share); infoPanel = findViewById(R.id.info_panel); fadein = AnimationUtils.loadAnimation(this, R.anim.fadein); fadeout = AnimationUtils.loadAnimation(this, R.anim.fadeout); findViewById(R.id.back).setOnClickListener(v -> onBackPressed()); setSupportActionBar(toolbar);/*from ww w. ja va 2s. c om*/ viewPager.addOnPageChangeListener(this); resolveData(savedInstanceState); QiscusPhotoViewerPresenter presenter = new QiscusPhotoViewerPresenter(this); presenter.loadQiscusPhotos(qiscusComment.getTopicId()); shareButton.setOnClickListener(v -> { Pair<QiscusComment, File> qiscusPhoto = qiscusPhotos.get(position); shareImage(qiscusPhoto.second); }); }
From source file:com.bq.robotic.robopad_plusplus.RoboPad_plusplus.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_robo_pad_plusplus); robotType currentRobotType = (robotType) getIntent() .getSerializableExtra(RoboPadConstants.ROBOT_SELECTED_KEY); mFragmentManager = getSupportFragmentManager(); connectButton = (ImageButton) findViewById(R.id.connect_button); disconnectButton = (ImageButton) findViewById(R.id.disconnect_button); anim = AnimationUtils.loadAnimation(this, R.anim.bluetooth_spiner); // If we're being restored from a previous state, // then we don't need to do anything and should return or else // we could end up with overlapping fragments. if (savedInstanceState != null) { return;/* w w w . j a v a 2s.c om*/ } // Show the selected robot fragment FragmentTransaction ft = mFragmentManager.beginTransaction(); switch (currentRobotType) { case POLLYWOG: ft.replace(R.id.game_pad_container, new PollywogFragment()); break; case BEETLE: ft.replace(R.id.game_pad_container, new BeetleFragment()); break; case RHINO: ft.replace(R.id.game_pad_container, new RhinoFragment()); break; case CRAB: ft.replace(R.id.game_pad_container, new CrabFragment()); break; case GENERIC_ROBOT: ft.replace(R.id.game_pad_container, new GenericRobotFragment()); break; } ft.commit(); }
From source file:ansteph.com.beecab.view.profile.DriverProfileView.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_profile_view); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w w w . ja v a2 s. c om*/ driverProfile = null; getSupportActionBar().setDisplayHomeAsUpEnabled(true); lnImage1 = (LinearLayout) findViewById(R.id.lnImage1); lnImage2 = (LinearLayout) findViewById(R.id.lnImage2); lnImage3 = (LinearLayout) findViewById(R.id.lnImage3); goleft1 = (ImageView) findViewById(R.id.goleft1); goleft2 = (ImageView) findViewById(R.id.goleft2); goleft3 = (ImageView) findViewById(R.id.goleft3); goright1 = (ImageView) findViewById(R.id.goright1); goright2 = (ImageView) findViewById(R.id.goright2); goright3 = (ImageView) findViewById(R.id.goright3); setTextField(); Bundle b = getIntent().getExtras(); if (b != null) { // txtID.setText(txtID.getText().toString() + " "+ b.getString("taxiID")); taxiID = b.getString("taxiID"); } if (taxiID != null && !taxiID.isEmpty()) { getImageData(); getProfileData(); } ratingBar = (RatingBar) findViewById(R.id.ratingBar); ratingBar.setRating(3); viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator); final Animation inAmin = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left); final Animation outAmin = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_out_right); viewAnimator.setInAnimation(inAmin); viewAnimator.setOutAnimation(outAmin); goleft1.setOnClickListener(this); goleft2.setOnClickListener(this); goleft3.setOnClickListener(this); goright1.setOnClickListener(this); goright2.setOnClickListener(this); goright3.setOnClickListener(this); }
From source file:samples.piggate.com.piggateCompleteExample.buyOfferActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_credit_card); //Set action bar fields getSupportActionBar().setTitle(PiggateUser.getEmail()); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); //Views/*from www . j a va2s. c o m*/ EditCardNumber = (EditText) findViewById(R.id.cardNumber); EditCVC = (EditText) findViewById(R.id.CVC); SpinnerYear = (Spinner) findViewById(R.id.spinerYear); SpinnerMonth = (Spinner) findViewById(R.id.spinerMonth); validate = (Button) findViewById(R.id.buttonValidate); buttonBuy = (Button) findViewById(R.id.buttonBuy); buttonCancel = (Button) findViewById(R.id.buttonCancel); headerLayout = (LinearLayout) findViewById(R.id.headerLayout); cardlayout = (LinearLayout) findViewById(R.id.cardlayout); buylayout = (LinearLayout) findViewById(R.id.buyLayout); image = (SmartImageView) findViewById(R.id.offerImage2); //Animations slidetoLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoleft); slidetoRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoright); slidefromRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromright); slidefromLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromleft); //Validation Error AlertDialog errorDialog = new AlertDialog.Builder(buyOfferActivity.this).create(); errorDialog.setTitle("Validation error"); errorDialog.setMessage("The credit card is not valid"); errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); //Network Error AlertDialog networkDialog = new AlertDialog.Builder(this).create(); networkDialog.setTitle("Network error"); networkDialog.setMessage("Network is not working"); networkDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); image.setImageUrl(getIntent().getExtras().getString("offerImgURL")); //Set the offer image from URL //(Provisional) set the default fields of the credit card EditCardNumber.setText("4242424242424242"); EditCVC.setText("123"); piggate = new Piggate(this); //Initialize Piggate Object //OnClick listener for the validate button validate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Validate the credit card with Stripe if (checkInternetConnection() == true) { // Credit card for testing: ("4242-4242-4242-4242", 12, 2016, "123") if (piggate.validateCard(EditCardNumber.getText().toString(), Integer.parseInt(SpinnerMonth.getSelectedItem().toString()), Integer.parseInt(SpinnerYear.getSelectedItem().toString()), EditCVC.getText().toString(), "pk_test_BN86VnxiMBHkZtzPmpykc56g", //Stripe test. Will be returned by requests in next release buyOfferActivity.this, "Validating", "Wait while the credit card is validated")) { openBuyLayout(); } else errorDialog.show(); } else { networkDialog.show(); } } }); //OnClick listener for the buy button buttonBuy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Do the buy request to the server RequestParams params = new RequestParams(); //Get the latest credit card Stripe token, amount to pay, type of coin and ID params.put("stripeToken", piggate.get_creditCards().get(piggate.get_creditCards().size() - 1) .getTokenID().toString()); params.put("amount", getIntent().getExtras().getString("offerPrice")); params.put("offerID", getIntent().getExtras().getString("offerID")); params.put("currency", getIntent().getExtras().getString("offerCurrency")); //Loading payment ProgressDialog loadingDialog = ProgressDialog.show(v.getContext(), "Payment", "Wait while the payment is finished", true); //Do the buy request to the server (The server do the payment with Stripe) piggate.RequestBuy(params).setListenerRequest(new Piggate.PiggateCallBack() { //onComplete method for JSONObject @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) { loadingDialog.dismiss(); //Go back to the offer list passing the offer attributes (to exchange) Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class); slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID")); slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName")); slideactivity.putExtra("offerDescription", getIntent().getExtras().getString("offerDescription")); slideactivity.putExtra("payment", true); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); } //onError method for JSONObject @Override public void onError(int statusCode, Header[] headers, String msg, JSONObject data) { //Show an error and go back to the credit card loadingDialog.dismiss(); //Go back to the offer list with the variable payment set to false (payment error) Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class); slideactivity.putExtra("payment", false); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); } //onComplete method for JSONArray @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) { loadingDialog.dismiss(); //Go back to the offer list passing the offer attributes (to exchange) Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class); slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID")); slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName")); slideactivity.putExtra("offerDescription", getIntent().getExtras().getString("offerDescription")); slideactivity.putExtra("payment", true); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); } //onError method for JSONArray (Show an error and go back to the credit card) @Override public void onError(int statusCode, Header[] headers, String msg, JSONArray data) { //Show an error and go back to the credit card loadingDialog.dismiss(); //Go back to the offer list with the variable payment set to false (payment error) Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class); slideactivity.putExtra("payment", false); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); } }).exec(); } }); //OnClick listener for the cancel button (Go back to the credit card) buttonCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { closeBuyLayout(); } }); }
From source file:com.shine.lottie.step.StepFragmentSample.java
@Override public void onError(@NonNull VerificationError error) { button.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.shake_error)); }
From source file:com.gubo.vosh.ScrollAwareFABBehavior.java
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; }/* w w w. j av a 2 s . c o m*/ public void onAnimationCancel(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.R.anim.fade_out); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }
From source file:com.mercandalli.android.apps.files.file.FileAddDialog.java
@SuppressWarnings("PMD.AvoidUsingHardCodedIP") public FileAddDialog(@NonNull final Activity activity, final int id_file_parent, @Nullable final IListener listener, @Nullable final IListener dismissListener) { super(activity, R.style.DialogFullscreen); mActivity = activity;/*from www . jav a 2s . c om*/ mDismissListener = dismissListener; mFileParentId = id_file_parent; mListener = listener; setContentView(R.layout.dialog_add_file); setCancelable(true); final View rootView = findViewById(R.id.dialog_add_file_root); rootView.startAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.dialog_add_file_open)); rootView.setOnClickListener(this); findViewById(R.id.dialog_add_file_upload_file).setOnClickListener(this); findViewById(R.id.dialog_add_file_add_directory).setOnClickListener(this); findViewById(R.id.dialog_add_file_text_doc).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogUtils.prompt(mActivity, mActivity.getString(R.string.dialog_file_create_txt), mActivity.getString(R.string.dialog_file_name_interrogation), mActivity.getString(R.string.dialog_file_create), new DialogUtils.OnDialogUtilsStringListener() { @Override public void onDialogUtilsStringCalledBack(String text) { //TODO create a online txt with content Toast.makeText(getContext(), getContext().getString(R.string.not_implemented), Toast.LENGTH_SHORT).show(); } }, mActivity.getString(android.R.string.cancel), null); FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_scan).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(mActivity.getPackageManager()) != null) { // Create the File where the photo should go ApplicationActivity.sPhotoFile = createImageFile(); // Continue only if the File was successfully created if (ApplicationActivity.sPhotoFile != null) { if (listener != null) { ApplicationActivity.sPhotoFileListener = listener; } takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(ApplicationActivity.sPhotoFile.getFile())); mActivity.startActivityForResult(takePictureIntent, ApplicationActivity.REQUEST_TAKE_PHOTO); } } FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_add_timer).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Calendar currentTime = Calendar.getInstance(); DialogDatePicker dialogDate = new DialogDatePicker(mActivity, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, final int year, final int monthOfYear, final int dayOfMonth) { Calendar currentTime = Calendar.getInstance(); DialogTimePicker dialogTime = new DialogTimePicker(mActivity, new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { Log.d("TIme Picker", hourOfDay + ":" + minute); final SimpleDateFormat dateFormatGmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.US); dateFormatGmt.setTimeZone(TimeZone.getTimeZone("UTC")); final SimpleDateFormat dateFormatLocal = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.US); String nowAsISO = dateFormatGmt.format(new Date()); final JSONObject json = new JSONObject(); try { json.put("type", "timer"); json.put("date_creation", nowAsISO); json.put("timer_date", "" + dateFormatGmt.format(dateFormatLocal.parse(year + "-" + (monthOfYear + 1) + "-" + dayOfMonth + " " + hourOfDay + ":" + minute + ":00"))); final SimpleDateFormat dateFormatGmtTZ = new SimpleDateFormat( "yyyy-MM-dd'T'HH-mm'Z'", Locale.US); dateFormatGmtTZ.setTimeZone(TimeZone.getTimeZone("UTC")); nowAsISO = dateFormatGmtTZ.format(new Date()); final List<StringPair> parameters = new ArrayList<>(); parameters.add(new StringPair("content", json.toString())); parameters.add(new StringPair("name", "TIMER_" + nowAsISO)); parameters.add( new StringPair("id_file_parent", "" + id_file_parent)); new TaskPost(mActivity, Constants.URL_DOMAIN + Config.ROUTE_FILE, new IPostExecuteListener() { @Override public void onPostExecute(JSONObject json, String body) { if (listener != null) { listener.execute(); } } }, parameters).execute(); } catch (JSONException | ParseException e) { Log.e(getClass().getName(), "Failed to convert Json", e); } } }, currentTime.get(Calendar.HOUR_OF_DAY), currentTime.get(Calendar.MINUTE), true); dialogTime.show(); } }, currentTime.get(Calendar.YEAR), currentTime.get(Calendar.MONTH), currentTime.get(Calendar.DAY_OF_MONTH)); dialogDate.show(); FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_article).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogCreateArticle dialogCreateArticle = new DialogCreateArticle(mActivity, listener); dialogCreateArticle.show(); FileAddDialog.this.dismiss(); } }); FileAddDialog.this.show(); }
From source file:com.procleus.brime.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sharedPreferences = getSharedPreferences("com.procleus.brime", MODE_PRIVATE); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w w w.j a v a 2s . c o m*/ labelsLayout = (FrameLayout) findViewById(R.id.labels); // TEXTVIEW REFERENCES textView1 = (TextView) findViewById(R.id.label_1); textView2 = (TextView) findViewById(R.id.label_2); textView3 = (TextView) findViewById(R.id.label_3); // === FAB REFRENCES === fab = (FloatingActionButton) findViewById(R.id.fab); fab1 = (FloatingActionButton) findViewById(R.id.fab_1); fab2 = (FloatingActionButton) findViewById(R.id.fab_2); fab3 = (FloatingActionButton) findViewById(R.id.fab_3); // FAB Animations show_fab = AnimationUtils.loadAnimation(getApplication(), R.anim.fab_open); hide_fab = AnimationUtils.loadAnimation(getApplication(), R.anim.fab_close); rotate_fab_forward = AnimationUtils.loadAnimation(getApplication(), R.anim.rotate_fab_forward); rotate_fab_backward = AnimationUtils.loadAnimation(getApplication(), R.anim.rotate_fab_backward); fab.setOnClickListener(this); fab2.setOnClickListener(this); fab3.setOnClickListener(this); fab1.setOnClickListener(this); // FAB END //calling function to show fab showFloatingActionButton(true); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); View hView = navigationView.getHeaderView(0); final TextView profile = (TextView) hView.findViewById(R.id.name); String name = sharedPreferences.getString("emailpref", "Guest"); profile.setText(name); Fragment fragment = new PublicFragment(); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction().replace(R.id.relativeLayout, fragment).commit(); getSupportActionBar().setTitle("Public NotesDbHelperOld"); }
From source file:com.github.kaninohon.poi.ui.widget.ScrollAwareFABBehavior.java
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; }//w w w .j av a 2 s . co m public void onAnimationCancel(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.fab_out); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }