-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature maya enter amount #1265
Merged
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
7787641
refactor: move ScanActivity and related classes to common
HashEngineering 85dcdb7
fix: align with Bitcoin Wallet code and replace deprecated functions
HashEngineering aab4935
refactor: use ScanActivity in common module
HashEngineering c857c40
refactor: move scan strings to common
HashEngineering e05027d
fix(maya): update strings for networks
HashEngineering 60bbf85
refactor: Io and AddressUtil strings to common
HashEngineering 3dc3cc3
refactor: move Bluetooth and PaymentIntent to common
HashEngineering e02c771
refactor: fix AndroidManifest.xml for ScanActivity
HashEngineering 031eb8b
refactor: fix AndroidManifest.xml for ScanActivity
HashEngineering 6085841
fix: use correct bitcoin address parameters
HashEngineering 852464f
feat: add AddressInputFragment to common and use in maya
HashEngineering 0b9f509
refactor: derive fragments from AddressInputFragment
HashEngineering 321c23a
refactor: simplify AddressInputFragment and view model
HashEngineering 4a2a370
refactor: make PaymentProcessors a class
HashEngineering a39466e
fix: support bitcoin segwit
HashEngineering 46e0f0e
feat: add support for inputting addresses from other modules
HashEngineering 220cd3d
fix: improve validation
HashEngineering 1581ee7
Merge branch 'feature-maya-dest-address' of https://github.com/dashev…
HashEngineering 99f768f
feat: look up on uphold
HashEngineering 0f637f5
feat: cache accounts and addresses
HashEngineering a00467c
refactor: use coroutines instead of callbacks
HashEngineering c171d30
fix: clear config when token is revoked
HashEngineering b920955
Merge branch 'feature-maya' of https://github.com/dashevo/dash-wallet…
HashEngineering 911fb10
fix: remove some changes in WalletActivity
HashEngineering 9456bb7
feat: link to exchanges to login
HashEngineering a510907
feat: close Uphold if login_and_close
HashEngineering 2faa275
feat: close Uphold if login_and_close
HashEngineering 77cd30b
feat: move deeplink destination to IntegrationOverviewFragment
HashEngineering 643f741
fix: uri support
HashEngineering 7ee2e66
feat: add "connect" text for if address sources don't have any addresses
HashEngineering 2e96506
fix: after connecting to an exchange, click will put the address in t…
HashEngineering 04d0dc2
fix: remove unused functions in the ExchangeIntegrationProvider inter…
HashEngineering fbe7554
refactor: rename UpholdCardAddress to to UpholdAddress
HashEngineering 561bb05
Rename .java to .kt
HashEngineering 8f64026
refactor: remove Java UpholdAddress and use kotlin version
HashEngineering ccdaaff
docs: add license and comments
HashEngineering 88e3e21
feat: add enter amount screen for maya swap
HashEngineering 7031416
feat: add enter amount screen for maya swap - phase 1
HashEngineering 61ce4a8
fix: the default payment intent parser
HashEngineering d634dff
fix: fixes for enter amount
HashEngineering 149152b
fix: fix for exchange rates
HashEngineering 9b008ce
fix: set guideline
HashEngineering 0ae082f
feat: add inbound_addresses api and other fixes
HashEngineering 6f092fd
fix: many improvements
HashEngineering ca31560
fix: use AmountView
HashEngineering 2f0590c
fix: attempt to resolve rounding issues
HashEngineering 236be26
fix: use Amount class and eliminate rounding errors
HashEngineering 91aa743
fix: fix alignment and visitibility issues and remove trailing zeros …
HashEngineering 4d4a52f
style: ktlint
HashEngineering e05c647
Merge branch 'feature-maya' of https://github.com/dashevo/dash-wallet…
HashEngineering 7883760
refactor: Amount class and add anchor
HashEngineering 42a5ef8
refactor: Amount class and add anchor
HashEngineering 4beb824
fix: put more things in the scrolling area
HashEngineering bf9fff8
fix: eliminate various bugs with format
HashEngineering 74db945
fix: fix the search function in the crypto list
HashEngineering b49b77b
fix: rearrange address input scrollable elements
HashEngineering 90e2ebe
fix: adjust amount input to fit
HashEngineering c7d255e
fix: use CenteredImageSpan for SDK < 29
HashEngineering a97ce61
fix: repair max and other conversions
HashEngineering 2369ee8
chore: remove unused code
HashEngineering e2b559f
style: ktlint
HashEngineering 9117627
chore: remove more unused code and update Copyright
HashEngineering 4c37ec5
chore: remove more unused code
HashEngineering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
common/src/main/java/org/dash/wallet/common/ui/enter_amount/CenteredImageSpan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.dash.wallet.common.ui.enter_amount | ||
|
||
import android.content.Context | ||
import android.graphics.Canvas | ||
import android.graphics.Paint | ||
import android.graphics.drawable.Drawable | ||
import android.text.style.ReplacementSpan | ||
|
||
class CenteredImageSpan(private val drawable: Drawable, private val context: Context) : ReplacementSpan() { | ||
override fun getSize( | ||
paint: Paint, | ||
text: CharSequence?, | ||
start: Int, | ||
end: Int, | ||
fm: Paint.FontMetricsInt? | ||
): Int { | ||
val rect = drawable.bounds | ||
|
||
fm?.let { | ||
val textHeight = fm.bottom - fm.top | ||
val centerY = fm.top + textHeight / 2 | ||
|
||
val drawableHeight = rect.bottom - rect.top | ||
val drawableCenterY = rect.top + drawableHeight / 2 | ||
|
||
// Calculate offset to align image center to text center | ||
val alignmentOffset = drawableCenterY - centerY | ||
|
||
it.ascent = fm.ascent + alignmentOffset | ||
it.top = fm.top + alignmentOffset | ||
it.bottom = fm.bottom + alignmentOffset | ||
it.descent = fm.descent + alignmentOffset | ||
} | ||
|
||
return rect.right | ||
} | ||
|
||
override fun draw( | ||
canvas: Canvas, | ||
text: CharSequence?, | ||
start: Int, | ||
end: Int, | ||
x: Float, | ||
top: Int, | ||
y: Int, | ||
bottom: Int, | ||
paint: Paint | ||
) { | ||
canvas.save() | ||
|
||
val fm = paint.fontMetricsInt | ||
val textHeight = fm.descent - fm.ascent | ||
val centerY = y + fm.descent - textHeight / 2 | ||
|
||
val drawableHeight = drawable.bounds.height() | ||
val drawableCenterY = drawable.bounds.top + drawableHeight / 2 | ||
|
||
// Align the center of the drawable with the center of the text | ||
val transY = centerY - drawableCenterY | ||
|
||
canvas.translate(x, transY.toFloat()) | ||
drawable.draw(canvas) | ||
|
||
canvas.restore() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The symbol is now inserted into the Text Span, rather than being in a separate view.