various fixes for android
This commit is contained in:
parent
f92c3cadf0
commit
5e41c99d8d
|
@ -29,7 +29,6 @@ from decimal import Decimal
|
||||||
import datetime, re
|
import datetime, re
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def modal_dialog(title, msg = None):
|
def modal_dialog(title, msg = None):
|
||||||
droid.dialogCreateAlert(title,msg)
|
droid.dialogCreateAlert(title,msg)
|
||||||
droid.dialogSetPositiveButtonText('OK')
|
droid.dialogSetPositiveButtonText('OK')
|
||||||
|
@ -283,12 +282,12 @@ payto_layout = make_layout("""
|
||||||
<TextView android:id="@+id/labelTextView"
|
<TextView android:id="@+id/labelTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Description:"
|
android:text="Message:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:gravity="left">
|
android:gravity="left">
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
<EditText android:id="@+id/label"
|
<EditText android:id="@+id/message"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:tag="Tag Me" android:inputType="text">
|
android:tag="Tag Me" android:inputType="text">
|
||||||
|
@ -322,7 +321,6 @@ settings_layout = make_layout(""" <ListView
|
||||||
android:layout_height="wrap_content" />""")
|
android:layout_height="wrap_content" />""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_history_values(n):
|
def get_history_values(n):
|
||||||
values = []
|
values = []
|
||||||
h = wallet.get_tx_history()
|
h = wallet.get_tx_history()
|
||||||
|
@ -337,10 +335,10 @@ def get_history_values(n):
|
||||||
time_str = str( dt.date() )
|
time_str = str( dt.date() )
|
||||||
except Exception:
|
except Exception:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
|
|
||||||
conf_str = 'v' if conf else 'o'
|
conf_str = 'v' if conf else 'o'
|
||||||
label, is_default_label = wallet.get_label(tx_hash)
|
label, is_default_label = wallet.get_label(tx_hash)
|
||||||
values.append((conf_str, ' ' + time_str, ' ' + format_satoshis(value,True), ' ' ))
|
label = label.replace('<','').replace('>','')
|
||||||
|
values.append((conf_str, ' ' + time_str, ' ' + format_satoshis(value,True), ' ' + label))
|
||||||
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
@ -454,7 +452,7 @@ def pay_to(recipient, amount, label):
|
||||||
return
|
return
|
||||||
|
|
||||||
if label:
|
if label:
|
||||||
wallet.labels[tx.hash()] = label
|
wallet.set_label(tx.hash(), label)
|
||||||
|
|
||||||
droid.dialogDismiss()
|
droid.dialogDismiss()
|
||||||
|
|
||||||
|
@ -579,7 +577,7 @@ def payto_loop():
|
||||||
|
|
||||||
droid.fullQuery()
|
droid.fullQuery()
|
||||||
recipient = droid.fullQueryDetail("recipient").result.get('text')
|
recipient = droid.fullQueryDetail("recipient").result.get('text')
|
||||||
label = droid.fullQueryDetail("label").result.get('text')
|
message = droid.fullQueryDetail("message").result.get('text')
|
||||||
amount = droid.fullQueryDetail('amount').result.get('text')
|
amount = droid.fullQueryDetail('amount').result.get('text')
|
||||||
|
|
||||||
if not is_address(recipient):
|
if not is_address(recipient):
|
||||||
|
@ -592,7 +590,7 @@ def payto_loop():
|
||||||
modal_dialog('Error','Invalid amount')
|
modal_dialog('Error','Invalid amount')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result = pay_to(recipient, amount, label)
|
result = pay_to(recipient, amount, message)
|
||||||
if result:
|
if result:
|
||||||
out = 'main'
|
out = 'main'
|
||||||
|
|
||||||
|
@ -606,12 +604,14 @@ def payto_loop():
|
||||||
if r:
|
if r:
|
||||||
data = str(r['extras']['SCAN_RESULT']).strip()
|
data = str(r['extras']['SCAN_RESULT']).strip()
|
||||||
if data:
|
if data:
|
||||||
|
print "data", data
|
||||||
if re.match('^bitcoin:', data):
|
if re.match('^bitcoin:', data):
|
||||||
payto, amount, label, _, _ = util.parse_URI(data)
|
payto, amount, label, message, _ = util.parse_URI(data)
|
||||||
|
if amount:
|
||||||
amount = str(amount/100000000)
|
amount = str(amount/100000000)
|
||||||
droid.fullSetProperty("recipient", "text", payto)
|
droid.fullSetProperty("recipient", "text", payto)
|
||||||
droid.fullSetProperty("amount", "text", amount)
|
droid.fullSetProperty("amount", "text", amount)
|
||||||
droid.fullSetProperty("label", "text", label)
|
droid.fullSetProperty("message", "text", message)
|
||||||
elif is_address(data):
|
elif is_address(data):
|
||||||
droid.fullSetProperty("recipient", "text", data)
|
droid.fullSetProperty("recipient", "text", data)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue