N1CK145 5 years ago
parent
commit
1ebd2a6666
  1. 2
      app/build.gradle
  2. BIN
      app/src/main/ic_launcher_dragon-web.png
  3. 25
      app/src/main/java/org/myhush/silentdragon/ConnectionManager.kt
  4. 13
      app/src/main/java/org/myhush/silentdragon/MainActivity.kt
  5. 27
      app/src/main/java/org/myhush/silentdragon/SendActivity.kt
  6. 2
      app/src/main/java/org/myhush/silentdragon/UnconfirmedTxItemFragment.kt
  7. 6
      app/src/main/res/layout/content_main.xml
  8. 2
      app/src/main/res/layout/content_receive.xml
  9. 2
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  10. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_dragon.xml
  11. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_dragon_round.xml
  12. 4
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_hush_new.xml
  13. 2
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  14. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_dragon.png
  15. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_dragon_foreground.png
  16. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_dragon_round.png
  17. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_dragon.png
  18. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_dragon_foreground.png
  19. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_dragon_round.png
  20. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_dragon.png
  21. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_dragon_foreground.png
  22. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_dragon_round.png
  23. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon.png
  24. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon_foreground.png
  25. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon_round.png
  26. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon.png
  27. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon_foreground.png
  28. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon_round.png
  29. 4
      app/src/main/res/values/ic_launcher_dragon_background.xml

2
app/build.gradle

@ -18,7 +18,7 @@ android {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "0.5.6"
versionName "0.5.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

BIN
app/src/main/ic_launcher_dragon-web.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

25
app/src/main/java/org/myhush/silentdragon/ConnectionManager.kt

@ -113,19 +113,28 @@ object ConnectionManager {
}
fun initCurrencies(){
try {
DataModel.currencySymbols["USD"] = "$"
DataModel.currencySymbols["AUD"] = "$"
DataModel.currencySymbols["CAD"] = "$"
DataModel.currencySymbols["CNY"] = "¥"
DataModel.currencySymbols["EUR"] = ""
DataModel.currencySymbols["GBP"] = "£"
DataModel.currencySymbols["JPY"] = "¥"
DataModel.currencySymbols["CNY"] = "¥"
DataModel.currencySymbols["RUB"] = "\u20BD"
DataModel.currencySymbols["KRW"] = ""
DataModel.currencySymbols["MXN"] = "$"
DataModel.currencySymbols["MYR"] = "RM"
DataModel.currencySymbols["PHP"] = ""
DataModel.currencySymbols["PKR"] = ""
DataModel.currencySymbols["RUB"] = ""
DataModel.currencySymbols["SGD"] = "$"
DataModel.currencySymbols["GBP"] = "£"
DataModel.currencySymbols["AUD"] = "$"
DataModel.currencySymbols["CAD"] = "$"
DataModel.currencySymbols["THB"] = "฿"
DataModel.currencySymbols["USD"] = "$"
DataModel.currencySymbols["VEF"] = "Bs"
DataModel.currencySymbols["VND"] = ""
DataModel.currencySymbols["ZAR"] = "R"
Thread {
val client = OkHttpClient()
val currencies = "usd,eur,jpy,btc,cny,rub,cad,sgd,chf,inr,gbp,aud"
val currencies = "usd,eur,jpy,btc,cny,rub,cad,sgd,chf,inr,gbp,aud,pkr,mxn,php,vnd,thb,zar,krw,myr,vef"
val request: Request = Request.Builder()
.url("https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=${currencies}")
.build()
@ -170,7 +179,7 @@ object ConnectionManager {
Timer().schedule(object : TimerTask() {
override fun run() {
DataModel.makeAPICalls()
}}, 1000)
}}, 100)
}
}

13
app/src/main/java/org/myhush/silentdragon/MainActivity.kt

@ -69,8 +69,15 @@ class MainActivity : AppCompatActivity(),
}
txtMainBalanceUSD.setOnClickListener {
Toast.makeText(applicationContext, "1 HUSH = ${DataModel.currencySymbols[DataModel.selectedCurrency]}${DecimalFormat("#.##")
if(DataModel.selectedCurrency == "BTC")
Toast.makeText(applicationContext, "1 HUSH = ${DataModel.currencySymbols[DataModel.selectedCurrency]}${DecimalFormat(" #,##0.00000000")
.format(DataModel.currencyValues[DataModel.selectedCurrency])}", Toast.LENGTH_LONG).show()
else(
Toast.makeText(applicationContext, "1 HUSH = ${DataModel.currencySymbols[DataModel.selectedCurrency]}${DecimalFormat("#,##0.00")
.format(DataModel.currencyValues[DataModel.selectedCurrency])}", Toast.LENGTH_LONG).show()
)
}
bottomNav.setOnNavigationItemSelectedListener {
@ -176,8 +183,8 @@ class MainActivity : AppCompatActivity(),
val balText = DecimalFormat("#0.00000000").format(bal)
lblBalance.text = "Balance"
txtMainBalance.text = balText.substring(0, balText.length - 4) + " ${DataModel.mainResponseData?.tokenName} "
if(cur.length > 1)
txtMainBalance.text = balText + " ${DataModel.mainResponseData?.tokenName} "
if(cur == "BTC")
txtMainBalanceUSD.text = "${DataModel.currencySymbols[cur]} " + DecimalFormat("0.00000000").format(bal * price)
else
txtMainBalanceUSD.text = "${DataModel.currencySymbols[cur]} " + DecimalFormat("#,##0.00").format(bal * price)

27
app/src/main/java/org/myhush/silentdragon/SendActivity.kt

@ -64,8 +64,14 @@ class SendActivity : AppCompatActivity() {
if (DataModel.currencyValues["USD"] == null)
ConnectionManager.initCurrencies()
amountUSD.text = "${DataModel.currencySymbols[DataModel.selectedCurrency]} 0.00"
textViewFee.text = "0.0001 HUSH"
if (DataModel.selectedCurrency == "BTC")
amountUSD.text = "${DataModel.currencySymbols[DataModel.selectedCurrency]} " + DecimalFormat("0.00000000").format(0)
else
{
amountUSD.text = "${DataModel.currencySymbols[DataModel.selectedCurrency]} " + DecimalFormat("0.00").format(0)
}
textViewFee.text = DecimalFormat("0.0000").format(0.0001) + " HUSH"
sendAddress.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
@ -113,9 +119,17 @@ class SendActivity : AppCompatActivity() {
}
if (hush == null || price == null)
amountUSD.text = "$symbol 0.0"
if (symbol == "BTC")
amountUSD.text = "$symbol " + DecimalFormat("0.00000000").format(0)
else {
amountUSD.text = "$symbol " + DecimalFormat("0.00").format(0)
}
else
amountUSD.text = "$symbol " + DecimalFormat("#.########").format(hush * price)
if (symbol == "BTC")
amountUSD.text = "$symbol " + DecimalFormat("#,##0.00000000").format(hush * price)
else {
amountUSD.text = "$symbol " + DecimalFormat("#,##0.00").format(hush * price)
}
}
})
@ -171,7 +185,7 @@ class SendActivity : AppCompatActivity() {
val alertDialog = AlertDialog.Builder(this@SendActivity)
alertDialog.setTitle("Send from t-addr?")
alertDialog.setMessage("${DataModel.mainResponseData?.tokenName} $amt is more than the balance in " +
alertDialog.setMessage("$amt ${DataModel.mainResponseData?.tokenName} is more than the balance in " +
"your shielded address. This Tx will have to be sent from a transparent address, and will" +
" not be private.\n\nAre you absolutely sure?")
alertDialog.apply {
@ -251,8 +265,7 @@ class SendActivity : AppCompatActivity() {
// HUSH field manually.
amountHUSH.setText((DecimalFormat("#.########").format(amt) + "${DataModel.mainResponseData?.tokenName}"))
Toast.makeText(this.applicationContext, amt.toString(), Toast.LENGTH_SHORT).show()
amountUSD.text =
"${DataModel.currencySymbols[DataModel.selectedCurrency]} " + DecimalFormat("#.########").format(amt)
amountUSD.text = "${DataModel.currencySymbols[DataModel.selectedCurrency]} " + DecimalFormat("#,##0.00").format(amt)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

2
app/src/main/java/org/myhush/silentdragon/UnconfirmedTxItemFragment.kt

@ -56,7 +56,7 @@ class UnconfirmedTxItemFragment : Fragment() {
}
val txt = view.findViewById<TextView>(R.id.txtUnconfirmedTx)
txt.text = (if (tx?.type == "send") "Sending" else "Receiving") +
txt.text = (if (tx?.type == "send") "Sending " else "Receiving ") +
DecimalFormat("#0.00########").format(kotlin.math.abs(tx?.amount?.toDoubleOrNull() ?: 0.0)) + " ${DataModel.mainResponseData?.tokenName} "
return view

6
app/src/main/res/layout/content_main.xml

@ -55,13 +55,13 @@
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="46dp"
android:layout_marginTop="125dp"
android:layout_height="80dp"
android:layout_marginTop="107dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher_hush_new_foreground" />
app:srcCompat="@mipmap/ic_launcher_dragon_foreground" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"

2
app/src/main/res/layout/content_receive.xml

@ -33,7 +33,7 @@
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:id="@+id/txtRcvAddrTitle" android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/imageView" android:textColor="@color/colorPrimary"/>
app:layout_constraintTop_toBottomOf="@+id/imageView" android:textColor="@color/light_grey"/>
<android.support.design.widget.TabLayout
android:layout_width="395dp"
android:layout_height="wrap_content"

2
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
</adaptive-icon>

5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_dragon.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
</adaptive-icon>

5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_dragon_round.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
</adaptive-icon>

4
app/src/main/res/mipmap-anydpi-v26/ic_launcher_hush_new.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_hush_new_background"/>
<foreground android:drawable="@mipmap/ic_launcher_hush_new_foreground"/>
<background android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
<foreground android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
</adaptive-icon>

2
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@mipmap/ic_launcher_dragon_foreground"/>
</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher_dragon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
app/src/main/res/mipmap-hdpi/ic_launcher_dragon_foreground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
app/src/main/res/mipmap-hdpi/ic_launcher_dragon_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
app/src/main/res/mipmap-mdpi/ic_launcher_dragon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
app/src/main/res/mipmap-mdpi/ic_launcher_dragon_foreground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
app/src/main/res/mipmap-mdpi/ic_launcher_dragon_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_dragon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_dragon_foreground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_dragon_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon_foreground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_dragon_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon_foreground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_dragon_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

4
app/src/main/res/values/ic_launcher_dragon_background.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_dragon_background">#FFFFFF</color>
</resources>
Loading…
Cancel
Save