Ejemplo n.º 1
0
  // Inflate the view for the fragment based on layout XML
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    try {
      View view = inflater.inflate(R.layout.view_pager, container, false);
      tvLabelRate = (TextView) view.findViewById(R.id.txt_rate_amount);
      lstCurrencyView = (ListView) view.findViewById(R.id.currency_list);
      // WheelView wheel = (WheelView) view.findViewById(R.id.wheel_picker);

      List<String> lstCurrencies = new ArrayList<>();
      lstCurrencies.add(FiatCurrency.VENEZUELAN_BOLIVAR.getCode());
      lstCurrencies.add(FiatCurrency.US_DOLLAR.getCode());
      lstCurrencies.add(FiatCurrency.BITCOIN.getCode());

      ArrayAdapter<String> arrayAdapter =
          new ArrayAdapter<String>(getActivity(), R.layout.wheel_item, lstCurrencies);

      lstCurrencyView.setAdapter(arrayAdapter);

      lstCurrencyView.setOnItemClickListener(
          new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              TextView item = (TextView) view.findViewById(R.id.itemText);

              item.setTextColor(Color.parseColor("#2481BA"));
              item.setTextSize(16);

              fiatCurrency = String.valueOf(item.getText());
              try {
                fermatSession.setData(
                    SessionConstant.FIAT_CURRENCY, FiatCurrency.getByCode(fiatCurrency).getCode());
              } catch (InvalidParameterException e) {
                e.printStackTrace();
              }
              getAndShowMarketExchangeRateData();
            }
          });

      return view;

    } catch (Exception e) {
      e.printStackTrace();
    }

    return null;
  }
Ejemplo n.º 2
0
  // Store instance variables based on arguments passed
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {

      fermatWalletManager = fermatSession.getModuleManager();
      errorManager = fermatSession.getErrorManager();

      page = getArguments().getInt("someInt", 0);
      providerName = getArguments().getString("providerName");
      providerId = UUID.fromString(getArguments().getString("providerId"));

      if (fermatSession.getData(SessionConstant.FIAT_CURRENCY) != null)
        fiatCurrency = (String) fermatSession.getData(SessionConstant.FIAT_CURRENCY);
      else fiatCurrency = FiatCurrency.US_DOLLAR.getCode();

      getAndShowMarketExchangeRateData();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }