private void swipeLeft() { if (currentPosition < accounts.size() - 1) { View currentView = getChildAt(currentPosition); Animation fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_out); currentView.startAnimation(fadeInAnimation); currentView.setVisibility(View.GONE); View nextView = getChildAt(++currentPosition); fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_in); nextView.startAnimation(fadeInAnimation); nextView.setVisibility(View.VISIBLE); fadeInAnimation.setAnimationListener(endAnimationLister); } }
private void swipeRight() { // Now Set your animation if (currentPosition > 0) { View currentView = getChildAt(currentPosition); Animation fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_right_out); currentView.startAnimation(fadeInAnimation); currentView.setVisibility(View.GONE); View nextView = getChildAt(--currentPosition); fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_right_in); nextView.startAnimation(fadeInAnimation); nextView.setVisibility(View.VISIBLE); fadeInAnimation.setAnimationListener(endAnimationLister); } }
public void setAccounts(int layoutResourceId, List<Account> accounts) { this.layoutResourceId = layoutResourceId; this.accounts = accounts; layoutInflater = LayoutInflater.from(getContext()); for (int i = 0; i < accounts.size(); i++) { View view = getView(i, null, this); view.setVisibility(GONE); this.addView(view); } this.getChildAt(currentPosition).setVisibility(VISIBLE); this.gestureListener = new GestureListener(); this.gesturedetector = new GestureDetector(getContext(), gestureListener); }
private void bindData() { TippyTipperApplication appState = ((TippyTipperApplication) this.getApplication()); TextView lbl_split_amount = (TextView) findViewById(R.id.lbl_split_amount); TextView lbl_split_tip = (TextView) findViewById(R.id.lbl_split_tip); TextView lbl_split_adjustment = (TextView) findViewById(R.id.lbl_split_adjustment); TextView lbl_split_total = (TextView) findViewById(R.id.lbl_split_total); TextView lbl_NumberOfPeople = (TextView) findViewById(R.id.lbl_NumberOfPeople); View inflated_splitTax = findViewById(R.id.inflated_splitTax); float excludeTaxRate = Settings.getExcludeTaxRate(getBaseContext()); if (excludeTaxRate != 0) { ViewStub stub_splitTax = (ViewStub) findViewById(R.id.stub_splitTax); if (stub_splitTax != null) stub_splitTax.setVisibility(View.VISIBLE); else if (inflated_splitTax != null) inflated_splitTax.setVisibility(View.VISIBLE); TextView lbl_split_tax = (TextView) findViewById(R.id.lbl_split_tax); lbl_split_tax.setText(appState.service.getSplitTaxAmount()); } else { if (inflated_splitTax != null) inflated_splitTax.setVisibility(View.GONE); } lbl_split_amount.setText(appState.service.getSplitBillAmount()); lbl_split_tip.setText(appState.service.getSplitTipAmount()); lbl_split_adjustment.setText(appState.service.getSplitAdjustment()); lbl_split_total.setText(appState.service.getSplitTotalAmount()); lbl_NumberOfPeople.setText(Integer.toString(appState.service.getNumberOfPeople())); Map<String, String> params = new HashMap<String, String>(); params.put("Number of People", String.valueOf(appState.service.getNumberOfPeople())); params.put("Split Bill Amount", appState.service.getSplitBillAmount()); params.put("Split Tax Amount", appState.service.getSplitTaxAmount()); params.put("Split Tip Amount", appState.service.getSplitTipAmount()); params.put("Split Adjustment Amount", appState.service.getSplitAdjustment()); params.put("Split Total Amount", appState.service.getSplitTotalAmount()); FlurryAgent.onEvent("Split Bill Bind Data", params); }