private void setupUIData() {
    //        digitalAsset = (DigitalAsset) appSession.getData("asset_data");
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    toolbar.setTitle(digitalAsset.getName());

    //        if (digitalAsset.getImage() != null) {
    //            assetRedeemImage.setImageBitmap(BitmapFactory.decodeStream(new
    // ByteArrayInputStream(digitalAsset.getImage())));
    //        } else {
    //
    // assetRedeemImage.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    //        }
    byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage();
    BitmapWorkerTask bitmapWorkerTask =
        new BitmapWorkerTask(assetRedeemImage, res, R.drawable.img_asset_without_image, false);
    bitmapWorkerTask.execute(img); // todo comment to be able to compile

    assetRedeemNameText.setText(digitalAsset.getName());
    //        assetsToRedeemEditText.setText(digitalAsset.getAvailableBalanceQuantity() + "");
    assetsToRedeemEditText.setText(selectedRPCount + "");
    long quantity = digitalAsset.getAvailableBalanceQuantity();
    assetRedeemRemainingText.setText(
        quantity + ((quantity == 1) ? " Asset" : " Assets") + " Remaining");
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View layout = inflater.inflate(R.layout.ccw_fragement_create_new_location, container, false);

    countries = Country.values();
    ArrayAdapter<String> adapter =
        new ArrayAdapter<>(
            getActivity(), R.layout.ccw_spinner_item, getListOfCountryNames(countries));
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final Spinner countrySpinner = (Spinner) layout.findViewById(R.id.ccw_country_spinner);
    countrySpinner.setOnItemSelectedListener(this);
    countrySpinner.setAdapter(adapter);

    cityTextView = (FermatEditText) layout.findViewById(R.id.ccw_city_edit_text);
    stateEditText = (FermatEditText) layout.findViewById(R.id.ccw_state_edit_text);
    zipCodeEditText = (FermatEditText) layout.findViewById(R.id.ccw_zip_code_edit_text);
    addressLineOneEditText =
        (FermatEditText) layout.findViewById(R.id.ccw_address_line_1_edit_text);
    addressLineTwoEditText =
        (FermatEditText) layout.findViewById(R.id.ccw_address_line_2_edit_text);
    stateTextCount = (FermatTextView) layout.findViewById(R.id.ccw_state_edit_text_count);
    cityTextCount = (FermatTextView) layout.findViewById(R.id.ccw_city_edit_text_count);
    address1TextCount =
        (FermatTextView) layout.findViewById(R.id.ccw_address_line_1_edit_text_count);
    address2TextCount =
        (FermatTextView) layout.findViewById(R.id.ccw_address_line_2_edit_text_count);

    // Limit max length, add textWatchers
    cityTextView.setFilters(new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_CITY)});
    stateEditText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_STATE)});
    addressLineOneEditText.setFilters(
        new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_ADDRESS)});
    addressLineTwoEditText.setFilters(
        new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_ADDRESS)});

    cityTextView.addTextChangedListener(cityTextWatcher);
    stateEditText.addTextChangedListener(stateTextWatcher);
    addressLineOneEditText.addTextChangedListener(address1TextWatcher);
    addressLineTwoEditText.addTextChangedListener(address2TextWatcher);

    cityTextCount.setText(String.valueOf(MAX_LENGTH_CITY));
    stateTextCount.setText(String.valueOf(MAX_LENGTH_STATE));
    address1TextCount.setText(String.valueOf(MAX_LENGTH_ADDRESS));
    address2TextCount.setText(String.valueOf(MAX_LENGTH_ADDRESS));

    layout.findViewById(R.id.ccw_create_new_location_button).setOnClickListener(this);

    moduleManager = appSession.getModuleManager();

    configureToolbar();

    return layout;
  }
  private void setupUIData() {
    digitalAsset = (DigitalAsset) appSession.getData("asset_data");

    if (digitalAsset.getImage() != null) {
      assetDeliveryListImage.setImageBitmap(
          BitmapFactory.decodeStream(new ByteArrayInputStream(digitalAsset.getImage())));
    } else {
      assetDeliveryListImage.setImageDrawable(
          rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    }

    assetDeliveryListNameText.setText(digitalAsset.getName());
    assetDeliveryListRemainingText.setText(
        digitalAsset.getAvailableBalanceQuantity() + " Assets Remaining");
  }
Exemple #4
0
  @SuppressLint("SetTextI18n")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mDescription = (FermatTextView) findViewById(R.id.description);
    mUsername = (FermatTextView) findViewById(R.id.user_name);
    mTitle = (FermatTextView) findViewById(R.id.title);
    positiveBtn = (FermatButton) findViewById(R.id.positive_button);
    negativeBtn = (FermatButton) findViewById(R.id.negative_button);

    positiveBtn.setOnClickListener(this);
    negativeBtn.setOnClickListener(this);
    mDescription.setText(description != null ? description : "");
    mUsername.setText(username != null ? username : "");
    mTitle.setText(title != null ? title : "");
  }
 @SuppressLint("SetTextI18n")
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   FermatTextView positiveButtonView = (FermatTextView) findViewById(R.id.positive_button);
   FermatTextView negativeButtonView = (FermatTextView) findViewById(R.id.negative_button);
   mDescription = (FermatTextView) findViewById(R.id.description);
   positiveButtonView.setOnClickListener(rightClick);
   negativeButtonView.setOnClickListener(leftClick);
   mDescription.setText(description != null ? description : "");
   positiveButtonView.setText(leftButton != null ? leftButton : "");
   negativeButtonView.setText(rightButton != null ? rightButton : "");
   positiveButtonView.setOnClickListener(leftClick);
   negativeButtonView.setOnClickListener(rightClick);
 }
  @Override
  public void onLocationItemClicked(ExtendedCity city) {
    offset = 0;

    location = new DeviceLocation();
    location.setLatitude((double) city.getLatitude());
    location.setLongitude((double) city.getLongitude());

    distance = identity.getAccuracy();
    location.setAccuracy((long) distance);

    geolocationDialog.dismiss();
    locationFilterBarCountry.setText(city.getCountryName());
    locationFilterBarPlace.setText(city.getName());

    Animation slideUp = AnimationUtils.loadAnimation(getActivity(), R.anim.ccc_slide_up);
    locationFilterBar.setVisibility(View.VISIBLE);
    locationFilterBar.startAnimation(slideUp);

    onRefresh();
  }
  private void refreshUIData() {
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    assetRedeemNameText.setText(digitalAsset.getName());
    // assetsToDeliverEditText.setText(digitalAsset.getAvailableBalanceQuantity()+"");
    assetsToRedeemEditText.setText(selectedRPCount + "");
    assetRedeemRemainingText.setText(
        digitalAsset.getAvailableBalanceQuantity()
            + " "
            + getResources().getString(R.string.dap_user_wallet_remaining_assets));

    if (digitalAsset.getAvailableBalanceQuantity() == 0) {
      selectRPButton.setOnClickListener(null);
    }
  }
  public static View setUpHeaderScreen(
      LayoutInflater inflater, Context activity, ActiveActorIdentityInformation identity)
      throws CantGetActiveLoginIdentityException {
    /** Navigation view header */
    RelativeLayout relativeLayout = new RelativeLayout(activity);
    RelativeLayout.LayoutParams layoutParams =
        new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 180);
    relativeLayout.setLayoutParams(layoutParams);
    View view =
        inflater.inflate(R.layout.row_navigation_drawer_community_header, relativeLayout, true);
    ImageView imageView = (ImageView) view.findViewById(R.id.image_view_profile);
    if (identity != null) {
      if (identity.getImage() != null) {
        if (identity.getImage().length > 0) {
          imageView.setImageBitmap(
              (BitmapFactory.decodeByteArray(identity.getImage(), 0, identity.getImage().length)));
        } else Picasso.with(activity).load(R.drawable.profile_image).into(imageView);
      } else Picasso.with(activity).load(R.drawable.profile_image).into(imageView);
      FermatTextView fermatTextView = (FermatTextView) view.findViewById(R.id.txt_name);
      fermatTextView.setText(identity.getAlias());
    }

    return view;
  }
  private void setUpScreenComponents() {
    BitcoinConverter bitcoinConverter = new BitcoinConverter();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.confirmation_window);

    accept_btn = (Button) findViewById(R.id.accept_btn);
    cancel_btn = (Button) findViewById(R.id.cancel_btn);

    confirmText = (FermatTextView) findViewById(R.id.description_msg);

    accept_btn.setOnClickListener(this);
    cancel_btn.setOnClickListener(this);

    getWindow().setBackgroundDrawable(new ColorDrawable(0));

    String newAmount = bitcoinConverter.getBTC(String.valueOf(total));
    confirmText.setText("You will sending " + newAmount + " btc. Confirm?");
  }
  private void setupUIData() {
    //        digitalAsset = (DigitalAsset) appSession.getData("asset_data");
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    toolbar.setTitle(digitalAsset.getName());

    //        if (digitalAsset.getImage() != null) {
    //            assetImageDetail.setImageBitmap(BitmapFactory.decodeStream(new
    // ByteArrayInputStream(digitalAsset.getImage())));
    //        } else {
    //
    // assetImageDetail.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    //        }
    byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage();
    BitmapWorkerTask bitmapWorkerTask =
        new BitmapWorkerTask(assetImageDetail, res, R.drawable.img_asset_without_image, false);
    bitmapWorkerTask.execute(img); // todo comment to compile, please review.

    assetDetailRedeemLayout.setVisibility(
        (digitalAsset.getAvailableBalanceQuantity() > 0) ? View.VISIBLE : View.GONE);
    assetDetailAppropriateLayout.setVisibility(
        (digitalAsset.getAvailableBalanceQuantity() > 0) ? View.VISIBLE : View.GONE);

    assetDetailNameText.setText(digitalAsset.getName());
    assetDetailExpDateText.setText(digitalAsset.getFormattedExpDate());

    long available = digitalAsset.getAvailableBalanceQuantity();
    long book = digitalAsset.getBookBalanceQuantity();
    availableText.setText(availableText(available));
    if (available == book) {
      pendingText.setVisibility(View.INVISIBLE);
    } else {
      long pendingValue = Math.abs(available - book);
      pendingText.setText(pendingText(pendingValue));
      pendingText.setVisibility(View.VISIBLE);
    }

    assetDetailBtcText.setText(digitalAsset.getFormattedAvailableBalanceBitcoin() + " BTC");
  }
  public void bind(final Group group) {
    nameText.setText(group.getName());
    if (group.isSelected()) {
      selectUserButton.setImageDrawable(res.getDrawable(R.drawable.ic_deliver_user_remove));
    } else {
      selectUserButton.setImageDrawable(res.getDrawable(R.drawable.ic_deliver_user_add));
    }

    selectUserButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            if (!group.isSelected()) {
              group.setSelected(true);
              selectUserButton.setImageDrawable(res.getDrawable(R.drawable.ic_deliver_user_remove));
            } else {
              group.setSelected(false);
              selectUserButton.setImageDrawable(res.getDrawable(R.drawable.ic_deliver_user_add));
            }
          }
        });
  }
  @SuppressWarnings("unchecked")
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    if (data == null || project == null) return;

    /* Projects Fields */
    name.setText(project.getName());
    description.setText(project.getDescription());
    type.setText(project.getWalletType().name());

    /* temp data fields */
    mainScreenBytes = (byte[]) data.get(PublishFactoryProjectStep1.MAIN_SCREEN_KEY);
    iconScreenBytes = (byte[]) data.get(PublishFactoryProjectStep1.WALLET_ICON_KEY);
    screenShootsBytes = (ArrayList) data.get(PublishFactoryProjectStep1.SCREEN_SHOOTS_KEY);
    identity = (PublisherIdentity) data.get(PublishFactoryProjectStep2.PUBLISHER_IDENTITY_KEY);
    videoUrlString =
        data.get(PublishFactoryProjectStep2.VIDEO_URL_KEY) != null
            ? data.get(PublishFactoryProjectStep2.VIDEO_URL_KEY).toString()
            : "";
    initialVersion = (Version) data.get(PublishFactoryProjectStep2.INIT_PLATFORM_KEY);
    finalVersion = (Version) data.get(PublishFactoryProjectStep2.FINAL_PLATFORM_KEY);

    if (mainScreenBytes != null)
      mainScreen.setImageDrawable(
          new BitmapDrawable(
              getResources(),
              BitmapFactory.decodeByteArray(mainScreenBytes, 0, mainScreenBytes.length)));
    if (iconScreenBytes != null)
      iconScreen.setImageDrawable(
          new BitmapDrawable(
              getResources(),
              BitmapFactory.decodeByteArray(iconScreenBytes, 0, iconScreenBytes.length)));
    if (screenShootsBytes != null && screenShootsBytes.size() > 0)
      adapter.changeDataSet(screenShootsBytes);

    if (videoUrlString != null) video_url.setText(videoUrlString);

    if (initialVersion != null) {
      initPlatform.setText(String.format("Initial Platform v%s", initialVersion.toString()));
    }
    if (finalVersion != null) {
      finalPlatform.setText(String.format("Final Platform v%s", finalVersion.toString()));
    }
  }
  private void setupScreenComponents() {

    try {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.bw_create_transaction_dialog);

      dialogTitleLayout = (LinearLayout) findViewById(R.id.bnk_ctd_title_layout);
      dialogTitle = (FermatTextView) findViewById(R.id.bnk_ctd_title);
      amountText = (EditText) findViewById(R.id.bnk_ctd_amount);
      memoText = (AutoCompleteTextView) findViewById(R.id.bnk_ctd_memo);
      applyBtn = (Button) findViewById(R.id.bnk_ctd_apply_transaction_btn);
      cancelBtn = (Button) findViewById(R.id.bnk_ctd_cancel_transaction_btn);

      dialogTitleLayout.setBackgroundColor(getTransactionTitleColor());
      dialogTitle.setText(getTransactionTitleText());
      amountText.setFilters(new InputFilter[] {new NumberInputFilter(9, 2)});

      cancelBtn.setOnClickListener(this);
      applyBtn.setOnClickListener(this);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  private void setupUI() {
    setupBackgroundBitmap();

    assetRedeemImage = (ImageView) rootView.findViewById(R.id.assetRedeemImage);
    assetRedeemNameText = (FermatTextView) rootView.findViewById(R.id.assetRedeemNameText);
    assetRedeemRemainingText =
        (FermatTextView) rootView.findViewById(R.id.assetRedeemRemainingText);
    assetsToRedeemEditText = (FermatEditText) rootView.findViewById(R.id.assetsToRedeemEditText);
    selectedRPText = (FermatTextView) rootView.findViewById(R.id.selectedRedeemPointsText);
    selectRPButton = rootView.findViewById(R.id.selectRedeemPointsButton);
    redeemAssetsButton = rootView.findViewById(R.id.redeemAssetsButton);

    //        layout = rootView.findViewById(R.id.assetDetailRemainingLayout);
    redeemAssetsButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            if (selectedRPCount > 0) {
              Object x = appSession.getData("redeem_points");
              if (x != null) {
                final List<RedeemPoint> redeemPoints = (List<RedeemPoint>) x;
                if (redeemPoints.size() > 0) {
                  new ConfirmDialog.Builder(getActivity(), appSession)
                      .setTitle(getResources().getString(R.string.dap_user_wallet_confirm_title))
                      .setMessage(
                          getResources().getString(R.string.dap_user_wallet_confirm_entered_info))
                      .setColorStyle(getResources().getColor(R.color.dap_user_wallet_principal))
                      .setYesBtnListener(
                          new ConfirmDialog.OnClickAcceptListener() {
                            @Override
                            public void onClick() {
                              int assetsAmount =
                                  Integer.parseInt(assetsToRedeemEditText.getText().toString());
                              doRedeem(
                                  digitalAsset.getAssetPublicKey(), redeemPoints, assetsAmount);
                            }
                          })
                      .build()
                      .show();
                }
              }
            } else {
              Toast.makeText(
                      activity,
                      getResources().getString(R.string.dap_user_wallet_validate_no_redeem_points),
                      Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });

    selectRPButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            //                appSession.setData("asset_data", data);
            changeActivity(
                Activities.DAP_WALLET_ASSET_USER_ASSET_REDEEM_SELECT_REDEEMPOINTS,
                appSession.getAppPublicKey());
          }
        });

    selectedRPCount = getRedeemPointsSelectedCount();
    String message =
        (selectedRPCount == 0)
            ? "Select redeem points"
            : selectedRPCount + " redeem points selected";
    selectedRPText.setText(message);
  }
 public void onTextChanged(CharSequence s, int start, int before, int count) {
   address2TextCount.setText(String.valueOf(MAX_LENGTH_ADDRESS - s.length()));
 }
 public void onTextChanged(CharSequence s, int start, int before, int count) {
   stateTextCount.setText(String.valueOf(MAX_LENGTH_STATE - s.length()));
 }