Skip to content

Instantly share code, notes, and snippets.

@cbedoy
Created April 23, 2015 04:02
Show Gist options
  • Save cbedoy/482c3c8ef5b0dd51c757 to your computer and use it in GitHub Desktop.
Save cbedoy/482c3c8ef5b0dd51c757 to your computer and use it in GitHub Desktop.
Codigo feo
package org.pademobile.viewcontrollers.inapp;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import org.pademobile.application.ApplicationLoader;
import org.pademobile.bills.R;
import org.pademobile.services.bills.FlurryService;
import org.pademobile.com.objects.Memento;
import org.pademobile.com.payment.interfaces.IPaymentOriginsRepresentationDelegate;
import org.pademobile.com.payment.interfaces.IPaymentOriginsRepresentationHandler;
import org.pademobile.com.services.MementoHandler;
import org.pademobile.com.services.NotificationCenter;
import org.pademobile.artifacts.inapp.PaymentOriginCellAdapter;
import org.pademobile.viewcontrollers.abstracts.AbstractViewController;
import java.util.ArrayList;
import java.util.HashMap;
import static org.pademobile.services.bills.FontSupportedService.*;
/**
* Created by Carlos Bedoy on 10/7/14.
*
* Mobile App Developer @Pademobile
*/
public class PaymentOriginViewController extends AbstractViewController implements IPaymentOriginsRepresentationHandler
{
private TextView serviceName;
private TextView amountView;
private TextView currencyView;
private TextView subtitleView;
private ListView paymentOriginList;
private Button actionCancel;
private View actionAdd;
private PaymentOriginCellAdapter paymentOriginCellAdapter;
private ArrayList<HashMap<String, Object>> viewModel;
private IPaymentOriginsRepresentationDelegate paymentOriginsRepresentationDelegate;
private MementoHandler mementoHandler;
public void setPaymentOriginsRepresentationDelegate(IPaymentOriginsRepresentationDelegate paymentOriginsRepresentationDelegate) {
this.paymentOriginsRepresentationDelegate = paymentOriginsRepresentationDelegate;
}
@Override
protected View onCreateView() {
view = ApplicationLoader.mainLayoutInflater.inflate(R.layout.inapp_payments_viewcontroller, null);
serviceName = (TextView) view.findViewById(R.id.payment_origins_title);
amountView = (TextView) view.findViewById(R.id.payment_origins_amount);
currencyView = (TextView) view.findViewById(R.id.payment_origins_kind);
subtitleView = (TextView) view.findViewById(R.id.payment_origin_subtitle);
paymentOriginList = (ListView) view.findViewById(R.id.payment_origins_listivew);
actionCancel = (Button) view.findViewById(R.id.payment_origins_cancel);
actionAdd = view.findViewById(R.id.payment_origins_add);
actionCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
appViewManager.getParentActivity().finish();
FlurryService.getInstance().logEvent("El usuario finalizo el flujo desde la vista de origenes de fondo del flujo normal");
}
});
actionAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
paymentOriginsRepresentationDelegate.addNewOrigin();
NotificationCenter.getInstance().postNotification(ApplicationLoader.REQUEST_ADD_WALLET_FROM_NORMAL_FLOW, this);
FlurryService.getInstance().logEvent("El usuario inicio el flujo de añadir un origen de fondo desde el flujo normal");
}
});
paymentOriginList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
paymentOriginsRepresentationDelegate.selectedPaymentOrigin(viewModel.get(i));
FlurryService.getInstance().logEvent("El usuario selecciono un origen de fondo para pagar el servicio");
}
});
serviceName.setTypeface(ApplicationLoader.regularFont);
amountView.setTypeface(ApplicationLoader.thinFont);
currencyView.setTypeface(ApplicationLoader.regularFont);
actionCancel.setTypeface(ApplicationLoader.regularFont);
((TextView) view.findViewById(R.id.payment_origin_subtitle)).setTypeface(ApplicationLoader.regularFont);
paymentOriginList.setAdapter(paymentOriginCellAdapter);
supportTextViewWithFontSize(serviceName, PAYMENT_ORIGINS_NAME_SERVICE);
supportTextViewWithFontSize(amountView, PAYMENT_ORIGINS_AMOUNT);
supportTextViewWithFontSize(currencyView, PAYMENT_ORIGINS_CURRENCY);
supportTextViewWithFontSize(subtitleView, PAYMENT_ORIGINS_TITLE);
supportTextViewWithFontSize(actionCancel, PAYMENT_ORIGINS_BUTTONS);
view.setContentDescription("PaymentOriginsViewController");
return view;
}
@Override
public void onAttachToWindow() {
Memento topMemento = mementoHandler.getTopMemento();
HashMap<String, Object> mementoData = topMemento.getMementoData();
this.serviceName.setText(mementoData.containsKey("name_service") ? mementoData.get("name_service").toString():"");
this.amountView.setText(mementoData.containsKey("amount_service") ? mementoData.get("amount_service").toString():"");
this.currencyView.setText(mementoData.containsKey("currency_service") ? mementoData.get("currency_service").toString() : "");
this.paymentOriginCellAdapter = new PaymentOriginCellAdapter(viewModel);
this.paymentOriginList.setAdapter(paymentOriginCellAdapter);
FlurryService.getInstance().logEvent("Se recarga la vista de origenes de fondo con nueva informacion");
super.onAttachToWindow();
}
@Override
public void onRemoveToWindow() {
serviceName = null;
amountView = null;
currencyView = null;
subtitleView = null;
paymentOriginList = null;
actionCancel = null;
actionAdd = null;
paymentOriginCellAdapter = null;
super.onRemoveToWindow();
}
@Override
public void representPaymentOrigins(ArrayList<HashMap<String, Object>> paymentOrigins)
{
this.viewModel = paymentOrigins;
this.appViewManager.presentViewForTag(this.tag);
}
public void setMementoHandler(MementoHandler mementoHandler) {
this.mementoHandler = mementoHandler;
}
}
package org.pademobile.view;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import org.pademobile.abstracts.AbstractViewController;
import org.pademobile.abstracts.AbstractWidget;
import org.pademobile.interfaces.IKeyboardLayoutDelegate;
import org.pademobile.interfaces.IKeyboardLayoutHandler;
import org.pademobile.interfaces.IMementoHandler;
import org.pademobile.interfaces.IPaymentOriginSelectorDelegate;
import org.pademobile.interfaces.IPaymentOriginSelectorHandler;
import org.pademobile.interfaces.IPaymentOriginsRepresentationDelegate;
import org.pademobile.interfaces.IPaymentOriginsRepresentationHandler;
import org.pademobile.interfaces.IRecipientView;
import org.pademobile.object.Memento;
import org.pademobile.service.ComissionService;
import org.pademobile.service.ImageService;
import org.pademobile.service.LocalizationService;
import org.pademobile.service.LocalizationService.LocalizationCode;
import org.pademobile.widget.ActionBarView;
import org.pademobile.widget.ActionBarView.KINDACTIONBAR;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import android.widget.ViewFlipper;
public class PaymentOriginsViewController extends AbstractViewController implements IPaymentOriginsRepresentationHandler, IPaymentOriginSelectorDelegate, IKeyboardLayoutDelegate {
private TextView fee;
private String amount;
private TextView quantity;
private TextView fee_currency;
private LinearLayout top_layout;
private ViewFlipper view_flipper;
private TextView quantity_currency;
private ImageView target_affiliate;
private int target_affiliate_image_width;
private int target_affiliate_image_height;
private HashMap<String, Object> currency_data;
private HashMap<String, Object> selected_origin;
private ArrayList<HashMap<String, Object>> payment_origins;
private HashMap<String, Object> caracteristicas_data;
private ActionBarView actionBarView;
private IRecipientView recipient_view;
public IRecipientView getRecipient_view() { return recipient_view; }
public void setRecipient_view(IRecipientView recipient_view) { this.recipient_view = recipient_view; }
private IMementoHandler memento_handler;
public IMementoHandler getMemento_handler() { return memento_handler; }
public void setMemento_handler(IMementoHandler memento_handler) { this.memento_handler = memento_handler; }
private IKeyboardLayoutHandler keyboard_layout;
public IKeyboardLayoutHandler getKeyboard_layout() { return keyboard_layout; }
public void setKeyboard_layout(IKeyboardLayoutHandler keyboard_layout) { this.keyboard_layout = keyboard_layout; }
private IPaymentOriginSelectorHandler payment_selector;
public IPaymentOriginSelectorHandler getPayment_selector() { return payment_selector; }
public void setPayment_selector(IPaymentOriginSelectorHandler payment_selector) { this.payment_selector = payment_selector; }
private IPaymentOriginsRepresentationDelegate representation_delegate;
public IPaymentOriginsRepresentationDelegate getRepresentation_delegate() { return representation_delegate; }
public void setRepresentation_delegate(IPaymentOriginsRepresentationDelegate representation_delegate) { this.representation_delegate = representation_delegate; }
public PaymentOriginsViewController(Context context) {
super(context);
this.amount = "";
}
@Override
protected LinearLayout initLayout() {
LinearLayout layout = new LinearLayout(this.context);
layout.setGravity(Gravity.CENTER_HORIZONTAL);
layout.setBackgroundColor(Color.WHITE);
layout.setOrientation(LinearLayout.VERTICAL);
actionBarView = new ActionBarView(this.context);
actionBarView.setParent(this);
actionBarView.setNeedWhiteIcons(true);
actionBarView.initViewWithKey(KINDACTIONBAR.BACKANDNEXT);
layout.addView(actionBarView);
int _height = this.view_height - ImageService.getInstance(null).getActionBarSize();
LayoutParams params = new LayoutParams(this.view_width, this.view_height);
layout.setLayoutParams(params);
int top_layout_width = this.view_width;
int top_layout_height = _height / 2;
this.top_layout = this.createTopLayout(top_layout_width, top_layout_height);
layout.addView(this.top_layout);
View separator = this.createSeparator(this.view_width, 1);
layout.addView(separator);
int flipper_width = this.view_width;
int flipper_height = _height - top_layout_height;
this.view_flipper = this.createViewFlipper(flipper_width, flipper_height);
layout.addView(this.view_flipper);
return layout;
}
private View createSeparator(int width, int height) {
View view = new View(this.context);
view.setBackgroundColor(Color.parseColor("#d0d0d0"));
LayoutParams separator_params = new LayoutParams(width, height);
view.setLayoutParams(separator_params);
return view;
}
private ViewFlipper createViewFlipper(int width, int height) {
ViewFlipper flipper = new ViewFlipper(this.context);
flipper.setBackgroundColor(Color.WHITE);
LayoutParams flipper_params = new LayoutParams(width, height);
flipper_params.gravity = Gravity.CENTER;
flipper.setLayoutParams(flipper_params);
TranslateAnimation in = new TranslateAnimation(width, 0, 0, 0);
in.setDuration(400);
in.setZAdjustment(Animation.ZORDER_TOP);
flipper.setInAnimation(in);
TranslateAnimation out = new TranslateAnimation(0, -width, 0, 0);
out.setDuration(400);
out.setZAdjustment(Animation.ZORDER_TOP);
flipper.setOutAnimation(out);
((AbstractWidget) this.getKeyboard_layout()).setView_width(width);
((AbstractWidget) this.getKeyboard_layout()).setView_height(height);
flipper.addView(((AbstractWidget) this.getKeyboard_layout()).getView(), 0);
((AbstractWidget) this.getPayment_selector()).setView_width(width);
((AbstractWidget) this.getPayment_selector()).setView_height(height);
flipper.addView(((AbstractWidget) this.getPayment_selector()).getView(), 1);
return flipper;
}
private LinearLayout createTopLayout(int width, int height) {
LinearLayout layout = new LinearLayout(this.context);
layout.setGravity(Gravity.CENTER);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setBackgroundColor(Color.parseColor("#ed6d4a"));
actionBarView.setBackgroundColor(Color.parseColor("#ed6d4a"));
LayoutParams params = new LayoutParams(width, height);
layout.setLayoutParams(params);
int affiliate_width = width;
int affiliate_height = height / 4;
this.target_affiliate = this.createTargetAffiliate(affiliate_width, affiliate_height);
layout.addView(this.target_affiliate);
int amount_width = width;
int amoun_height = height / 4;
LinearLayout amount_layout = this.createAmountLayout(amount_width, amoun_height);
layout.addView(amount_layout);
int fee_width = width;
int fee_height = height / 4;
LinearLayout fee_layout = this.createFeeLayout(fee_width, fee_height);
layout.addView(fee_layout);
int recipient_width = width;
int recipient_height = height / 4;
((AbstractWidget) this.getRecipient_view()).setView_width(recipient_width);
((AbstractWidget) this.getRecipient_view()).setView_height(recipient_height+1);
layout.addView(((AbstractWidget) this.getRecipient_view()).getView());
return layout;
}
private LinearLayout createFeeLayout(int width, int height) {
LinearLayout layout = this.createQuantityLayout(width, height);
String localized_amount = LocalizationService.getInstance().localizeCode(LocalizationCode.fee);
int amount_label_width = width / 2;
int amout_label_height = height;
TextView amount_label = this.createQuantityLabel(localized_amount, amount_label_width, amout_label_height);
amount_label.setGravity(Gravity.LEFT);
layout.addView(amount_label);
LinearLayout right_layout = new LinearLayout(this.context);
right_layout.setGravity(Gravity.CENTER);
right_layout.setBackgroundColor(Color.TRANSPARENT);
right_layout.setOrientation(LinearLayout.VERTICAL);
int right_layout_width = width / 2;
int right_layout_height = height;
LayoutParams params = new LayoutParams(right_layout_width, right_layout_height);
right_layout.setLayoutParams(params);
int quantity_width = right_layout_width;
int quantity_height = right_layout_height / 2;
this.fee = this.createAmountLabel(quantity_width, quantity_height);
this.fee.setTextColor(Color.parseColor("#99ffffff"));
this.fee.setTextSize(14);
this.fee.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
right_layout.addView(this.fee);
int currency_width = right_layout_width;
int currency_height = right_layout_height / 2;
this.fee_currency = this.createCurrencyLabel(currency_width, currency_height);
right_layout.addView(this.fee_currency);
layout.addView(right_layout);
return layout;
}
private LinearLayout createAmountLayout(int width, int height) {
LinearLayout layout = this.createQuantityLayout(width, height);
String localized_amount = LocalizationService.getInstance().localizeCode(LocalizationCode.amount);
int amount_label_width = width / 2;
int amout_label_height = height;
TextView amount_label = this.createQuantityLabel(localized_amount, amount_label_width, amout_label_height);
layout.addView(amount_label);
LinearLayout right_layout = new LinearLayout(this.context);
right_layout.setGravity(Gravity.CENTER);
right_layout.setBackgroundColor(Color.TRANSPARENT);
right_layout.setOrientation(LinearLayout.VERTICAL);
int right_layout_width = width / 2;
int right_layout_height = height;
LayoutParams params = new LayoutParams(right_layout_width, right_layout_height);
right_layout.setLayoutParams(params);
int quantity_width = right_layout_width;
int quantity_height = right_layout_height / 2;
this.quantity = this.createAmountLabel(quantity_width, quantity_height);
this.quantity.setTextSize(24);
right_layout.addView(this.quantity);
int currency_width = right_layout_width;
int currency_height = right_layout_height / 2;
this.quantity_currency = this.createCurrencyLabel(currency_width, currency_height);
right_layout.addView(this.quantity_currency);
layout.addView(right_layout);
return layout;
}
private TextView createCurrencyLabel(int width, int height) {
TextView label = new TextView(this.context);
label.setText("dollars");
label.setGravity(Gravity.TOP | Gravity.RIGHT);
label.setTextColor(Color.parseColor("#99ffffff"));
float scale = ImageService.getInstance(null).getScreenDensity();
label.setPadding(label.getPaddingLeft(), label.getPaddingTop(), (int)(10 * scale + 0.5), label.getPaddingBottom());
LayoutParams params = new LayoutParams(width, height);
label.setLayoutParams(params);
label.setTextSize(14);
return label;
}
private TextView createAmountLabel(int width, int height) {
TextView label = new TextView(this.context);
label.setText("$0.00");
label.setGravity(Gravity.CENTER | Gravity.RIGHT);
label.setTextColor(Color.parseColor("#f5f5f5"));
float scale = ImageService.getInstance(null).getScreenDensity();
label.setPadding(label.getPaddingLeft(), label.getPaddingTop(), (int)(10 * scale + 0.5), label.getPaddingBottom());
LayoutParams params = new LayoutParams(width, height);
label.setLayoutParams(params);
label.setTextSize(14);
return label;
}
private TextView createQuantityLabel(String title, int width, int height) {
TextView label = new TextView(this.context);
label.setText(title);
label.setGravity(Gravity.TOP | Gravity.LEFT);
label.setTextColor(Color.parseColor("#99ffffff"));
float scale = ImageService.getInstance(null).getScreenDensity();
label.setPadding((int)(10 * scale + 0.5), label.getPaddingTop(), label.getPaddingRight(), label.getPaddingBottom());
LayoutParams params = new LayoutParams(width, height);
label.setLayoutParams(params);
label.setTextSize(14);
return label;
}
private LinearLayout createQuantityLayout(int width, int height){
LinearLayout layout = new LinearLayout(this.context);
layout.setGravity(Gravity.CENTER);
layout.setBackgroundColor(Color.TRANSPARENT);
layout.setOrientation(LinearLayout.HORIZONTAL);
LayoutParams params = new LayoutParams(width, height);
layout.setLayoutParams(params);
return layout;
}
private ImageView createTargetAffiliate(int width, int height) {
ImageView affiliate = new ImageView(this.context);
affiliate.setBackgroundColor(Color.TRANSPARENT);
LayoutParams params = new LayoutParams(width, height);
params.gravity = Gravity.CENTER;
affiliate.setLayoutParams(params);
this.target_affiliate_image_width = width / 3;
this.target_affiliate_image_height = height;
Bitmap image = ImageService.getInstance(null).getBitmap(ImageService.pagemobile_white, this.target_affiliate_image_width, this.target_affiliate_image_height);
affiliate.setImageBitmap(image);
return affiliate;
}
@Override
public void representPaymentOrigins(ArrayList<HashMap<String, Object>> payment_origins) {
this.payment_origins = payment_origins;
this.getView_manager().presentViewForTag(this.tag);
}
@Override
public Bitmap getNextIcon() {
Bitmap icon = ImageService.getInstance(null).getBitmap(ImageService.next_white_icon);
return icon;
}
@Override
public Bitmap getBackIcon() {
Bitmap icon = ImageService.getInstance(null).getBitmap(ImageService.back_white_icon);
return icon;
}
@SuppressWarnings("unchecked")
@Override
public int getBackgroundColor() {
Memento memento = this.getMemento_handler().getTopMemento();
HashMap<String, Object> data = memento.getMemento_data();
HashMap<String, Object> target_service = (HashMap<String, Object>) data.get("target_service");
if(target_service != null) {
String background = target_service.get("background").toString();
return Color.parseColor(background);
} else
return Color.parseColor("#ed6d4a");
}
@SuppressWarnings("unchecked")
@Override
public void reload() {
this.getNotification_service().hideLoading();
this.buttons_status = true;
Memento memento = this.getMemento_handler().getTopMemento();
HashMap<String, Object> data = memento.getMemento_data();
HashMap<String, Object> service_info = (HashMap<String, Object>) data.get("service_info");
HashMap<String, Object> target_service = (HashMap<String, Object>) data.get("target_service");
this.caracteristicas_data = (HashMap<String, Object>) service_info.get("caracteristicas");
this.currency_data = (HashMap<String, Object>) data.get("user_currency");
String currency_name = ((HashMap<String, Object>) this.currency_data.get("datos_divisa")).get("sufijo").toString();
this.quantity_currency.setText(currency_name);
this.fee_currency.setText(currency_name);
HashMap<String, Object> target_user = (HashMap<String, Object>) data.get("target_user");
this.getRecipient_view().setUser(target_user);
this.selected_origin = this.payment_origins.get(0);
this.getKeyboard_layout().setOriginData(this.selected_origin);
if(target_service != null){
String image_name = target_service.get("image").toString();
Bitmap image = ImageService.getInstance(null).getBitmapFromFile(image_name);
if (image == null) {
target_affiliate.setVisibility(View.INVISIBLE);
} else {
target_affiliate.setVisibility(View.VISIBLE);
image = ImageService.getInstance(null).resizeBitmap(image, this.target_affiliate_image_width, this.target_affiliate_image_height);
this.target_affiliate.setImageBitmap(image);
}
String background = target_service.get("background").toString();
this.top_layout.setBackgroundColor(Color.parseColor(background));
this.actionBarView.setBackgroundColor(Color.parseColor(background));
}
this.amount = "";
this.digitClicked("0");
}
@Override
public void deleteClicked() {
if(!this.buttons_status)
return;
int len = this.amount.length();
if (len > 0)
this.amount = this.amount.substring(0, len - 1);
this.updateValues();
}
@Override
public void digitClicked(String digit) {
if(!this.buttons_status)
return;
int len = this.amount.length();
if(len < 9) {
if (digit.equals(".")) {
if (!this.amount.contains(digit))
this.amount += digit;
} else
this.amount += digit;
}
this.updateValues();
}
@SuppressWarnings("unchecked")
private void updateValues() {
double amount = Double.parseDouble(this.formatQuantity());
double fee = ComissionService.getInstance().getComissionForAmountWithData(amount, this.caracteristicas_data);
HashMap<String, Object> datos_divisa = (HashMap<String, Object>) this.currency_data.get("datos_divisa");
String prefijo = datos_divisa.get("prefijo").toString();
String sufijo = datos_divisa.get("sufijo").toString();
double decimales = (Double) datos_divisa.get("decimales");
String formato = prefijo + "%." + ((int) decimales) + "f " + sufijo;
String formated_amount = this.formatAmount(formato, amount);
String formated_fee = this.formatAmount(formato, fee);
this.quantity.setText(formated_amount);
this.fee.setText(formated_fee);
}
private String formatAmount(String format, double amount) {
String formatted_value = String.format(Locale.US, format, amount);
String new_value = "";
int count = 0;
for(int i = formatted_value.indexOf('.') - 1; i >= 0; i--) {
count++;
new_value = formatted_value.charAt(i) + new_value;
if(count % 3 == 0){
count = 0;
new_value = ',' + new_value;
}
}
new_value += formatted_value.substring(formatted_value.indexOf('.'));
if(new_value.charAt(0) == ',')
new_value = new_value.substring(1);
if(new_value.charAt(1) == ',')
new_value = new_value.charAt(0) + new_value.substring(2);
new_value = new_value.substring(0, new_value.lastIndexOf(' '));
return new_value;
}
private String formatQuantity()
{
String return_value;
String target = this.amount;
int len = target.length();
if (len <= 2) {
String zeros = "";
for (int i = len; i <= 2; i++)
zeros += "0";
return_value = zeros + target;
} else {
return_value = target;
if (len > 3) {
while (return_value.charAt(0) == '0') {
return_value = return_value.substring(1);
len = return_value.length();
if (len < 4)
break;
}
}
}
this.amount = return_value;
return_value = new StringBuffer(return_value).insert(return_value.length() - 2, ".").toString();
return return_value;
}
@Override
public void nextPressed() {
if(!this.buttons_status)
return;
if(this.amount.compareTo("000") != 0) {
HashMap<String, Object> data = this.selected_origin;
data.put("transaction_amount", this.amount);
this.getNotification_service().showLoading();
this.getRepresentation_delegate().selectedPaymentOrigin(data);
}
}
@Override
public void originClicked() {
if(!this.buttons_status)
return;
this.getPayment_selector().setPaymentOrigins(this.payment_origins);
TranslateAnimation in = new TranslateAnimation(this.view_width, 0, 0, 0);
in.setDuration(400);
in.setZAdjustment(Animation.ZORDER_TOP);
this.view_flipper.setInAnimation(in);
TranslateAnimation out = new TranslateAnimation(0, -this.view_width, 0, 0);
out.setDuration(400);
out.setZAdjustment(Animation.ZORDER_TOP);
this.view_flipper.setOutAnimation(out);
this.view_flipper.setDisplayedChild(1);
}
@Override
public void paymentOriginSelected(HashMap<String, Object> payment_origin) {
if(!this.buttons_status)
return;
this.selected_origin = payment_origin;
this.getKeyboard_layout().setOriginData(this.selected_origin);
TranslateAnimation in = new TranslateAnimation(-this.view_width, 0, 0, 0);
in.setDuration(400);
in.setZAdjustment(Animation.ZORDER_TOP);
this.view_flipper.setInAnimation(in);
TranslateAnimation out = new TranslateAnimation(0, this.view_width, 0, 0);
out.setDuration(400);
out.setZAdjustment(Animation.ZORDER_TOP);
this.view_flipper.setOutAnimation(out);
this.view_flipper.setDisplayedChild(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment