fix some prompt to obtain bcc
MODIFY
bither-android/res/layout/activity_split_bcc_address.xml
bither-android/res/layout/activity_split_bcc_address.xml
android:layout_height="match_parent"
android:background="@color/bg">
- <fragment
- android:id="@+id/fragment_split_address"
- android:name="net.bither.fragment.hot.HotAddressFragment"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="@dimen/title_bar_height"></fragment>
+ android:orientation="vertical">
<FrameLayout
android:id="@+id/fl_title_bar"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <fragment
+ android:id="@+id/fragment_split_address"
+ android:name="net.bither.fragment.hot.HotAddressFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
<include layout="@layout/layout_dropdown_message" />
+ </FrameLayout>
+ </LinearLayout>
</net.bither.ui.base.SwipeRightTouchView>
</FrameLayout>
\ No newline at end of file

MODIFY
bither-android/res/values/strings.xml
bither-android/res/values/strings.xml
<string name="obtain_BCC_send_title">Can Obtain</string>
<string name="obtain_BCC_BCC_name">BCC</string>
<string name="obtain_BCC_receive_address">Receive Address</string>
- <string name="obtain_BCC_to_address_hint">BCC Address</string>
+ <string name="obtain_BCC_to_address_hint">Bitpie BCC Address</string>
<string name="obtain_BCC_btn_obtain">Obtain</string>
<string name="not_bitpie_bcc_address">Not a Bitpie BCC address</string>
<string name="you_do_not_have_obtainable_bcc">You don\'t have obtainable BCC</string>

MODIFY
bither-android/src/net/bither/BitherSetting.java
bither-android/src/net/bither/BitherSetting.java
@@ -52,6 +52,7 @@ public class BitherSetting {
public static final long LAST_USAGE_THRESHOLD_JUST_MS = DateUtils.HOUR_IN_MILLIS;
public static final long LAST_USAGE_THRESHOLD_RECENTLY_MS = 2 * DateUtils.DAY_IN_MILLIS;
+ public static final String BCC = "BCC";
public class SwipeRightGesture {
public static final int SCROLL_DELAY_HORIZONTAL = 75;

MODIFY
bither-android/src/net/bither/activity/hot/SplitBCCHDAccountMonitoredSendActivity.java
bither-android/src/net/bither/activity/hot/SplitBCCHDAccountMonitoredSendActivity.java
@@ -18,6 +18,7 @@ import net.bither.bitherj.db.AbstractDb;
import net.bither.bitherj.exception.TxBuilderException;
import net.bither.bitherj.qrcode.QRCodeTxTransport;
import net.bither.bitherj.qrcode.QRCodeUtil;
+import net.bither.bitherj.utils.UnitUtil;
import net.bither.bitherj.utils.Utils;
import net.bither.preference.AppSharedPreference;
import net.bither.qrcode.ScanActivity;
@@ -25,7 +26,6 @@ import net.bither.runnable.BaseRunnable;
import net.bither.runnable.CompleteTransactionRunnable;
import net.bither.ui.base.DropdownMessage;
import net.bither.ui.base.dialog.DialogHdSendConfirm;
-import net.bither.util.UnitUtilWrapper;
import org.json.JSONObject;
@@ -63,9 +63,9 @@ public class SplitBCCHDAccountMonitoredSendActivity extends SplitBCCSendActivity
@Override
protected void initBalance() {
- tvBalance.setText(UnitUtilWrapper.formatValue(AddressManager.getInstance().getAmount(AbstractDb.
+ tvBalance.setText(UnitUtil.formatValue(AddressManager.getInstance().getAmount(AbstractDb.
hdAccountAddressProvider.getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO,AddressManager.getInstance()
- .getHDAccountMonitored().getHdSeedId()))));
+ .getHDAccountMonitored().getHdSeedId())),UnitUtil.BitcoinUnit.BTC));
}
@Override
@@ -90,6 +90,9 @@ public class SplitBCCHDAccountMonitoredSendActivity extends SplitBCCSendActivity
} else {
DropdownMessage.showDropdownMessage(SplitBCCHDAccountMonitoredSendActivity.this,
getString(R.string.not_bitpie_bcc_address));
+ if (dp.isShowing()) {
+ dp.dismiss();
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -163,7 +166,7 @@ public class SplitBCCHDAccountMonitoredSendActivity extends SplitBCCSendActivity
if (dp.isShowing()) {
dp.dismiss();
}
- new DialogHdSendConfirm(this, toAddress, tx, this).show();
+ new DialogHdSendConfirm(this, toAddress, tx, false, this).show();
}
@Override
@@ -247,6 +250,7 @@ public class SplitBCCHDAccountMonitoredSendActivity extends SplitBCCSendActivity
DropdownMessage.showDropdownMessage(SplitBCCHDAccountMonitoredSendActivity.this,R.string.send_success);
}
});
+ success = true;
} else {
final JSONObject jsonObj = jsonObject.getJSONObject("error");
final int code = jsonObj.getInt("code");
@@ -259,10 +263,6 @@ public class SplitBCCHDAccountMonitoredSendActivity extends SplitBCCSendActivity
});
success = false;
}
- success = true;
- tx = null;
- toAddress = null;
- btcAmount = 0;
} catch (Exception e) {
e.printStackTrace();
}

MODIFY
bither-android/src/net/bither/activity/hot/SplitBCCHDAccountSendActivity.java
bither-android/src/net/bither/activity/hot/SplitBCCHDAccountSendActivity.java
@@ -15,13 +15,13 @@ import net.bither.bitherj.crypto.SecureCharSequence;
import net.bither.bitherj.crypto.mnemonic.MnemonicException;
import net.bither.bitherj.db.AbstractDb;
import net.bither.bitherj.exception.TxBuilderException;
+import net.bither.bitherj.utils.UnitUtil;
import net.bither.bitherj.utils.Utils;
import net.bither.preference.AppSharedPreference;
import net.bither.runnable.BaseRunnable;
import net.bither.runnable.CompleteTransactionRunnable;
import net.bither.ui.base.DropdownMessage;
import net.bither.ui.base.dialog.DialogHdSendConfirm;
-import net.bither.util.UnitUtilWrapper;
import org.json.JSONObject;
@@ -53,8 +53,8 @@ public class SplitBCCHDAccountSendActivity extends SplitBCCSendActivity implemen
@Override
protected void initBalance() {
- tvBalance.setText(UnitUtilWrapper.formatValue(getAmount(AbstractDb.hdAccountAddressProvider.getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO,
- AddressManager.getInstance().getHDAccountHot().getHdSeedId()))));
+ tvBalance.setText(UnitUtil.formatValue(getAmount(AbstractDb.hdAccountAddressProvider.getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO,
+ AddressManager.getInstance().getHDAccountHot().getHdSeedId())),UnitUtil.BitcoinUnit.BTC));
}
@Override
@@ -76,6 +76,9 @@ public class SplitBCCHDAccountSendActivity extends SplitBCCSendActivity implemen
} else {
DropdownMessage.showDropdownMessage(SplitBCCHDAccountSendActivity.this,
getString(R.string.not_bitpie_bcc_address));
+ if (dp.isShowing()) {
+ dp.dismiss();
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -150,7 +153,7 @@ public class SplitBCCHDAccountSendActivity extends SplitBCCSendActivity implemen
if (dp.isShowing()) {
dp.dismiss();
}
- new DialogHdSendConfirm(this, toAddress, tx, this).show();
+ new DialogHdSendConfirm(this, toAddress, tx, false, this).show();
}
@Override
@@ -187,11 +190,8 @@ public class SplitBCCHDAccountSendActivity extends SplitBCCSendActivity implemen
DropdownMessage.showDropdownMessage(SplitBCCHDAccountSendActivity.this,R.string.send_success);
}
});
- }
success = true;
- tx = null;
- toAddress = null;
- btcAmount = 0;
+ }
} catch (Exception e) {
e.printStackTrace();
}

MODIFY
bither-android/src/net/bither/activity/hot/SplitBCCSendActivity.java
bither-android/src/net/bither/activity/hot/SplitBCCSendActivity.java
@@ -25,6 +25,7 @@ import net.bither.bitherj.core.Out;
import net.bither.bitherj.core.Tx;
import net.bither.bitherj.crypto.SecureCharSequence;
import net.bither.bitherj.db.AbstractDb;
+import net.bither.bitherj.utils.UnitUtil;
import net.bither.bitherj.utils.Utils;
import net.bither.preference.AppSharedPreference;
import net.bither.qrcode.ScanActivity;
@@ -41,7 +42,6 @@ import net.bither.ui.base.keyboard.EntryKeyboardView;
import net.bither.ui.base.keyboard.password.PasswordEntryKeyboardView;
import net.bither.ui.base.listener.IBackClickListener;
import net.bither.util.InputParser;
-import net.bither.util.UnitUtilWrapper;
import org.json.JSONObject;
@@ -115,8 +115,9 @@ public class SplitBCCSendActivity extends SwipeRightActivity implements EntryKey
}
protected void initBalance() {
- tvBalance.setText(UnitUtilWrapper.formatValue(getAmount(AbstractDb.txProvider.
- getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO, address.getAddress()))));
+ tvBalance.setText(UnitUtil.formatValue(getAmount(AbstractDb.txProvider.
+ getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO, address.getAddress())),
+ UnitUtil.BitcoinUnit.BTC));
}
private View.OnClickListener scanClick = new View.OnClickListener() {
@@ -166,9 +167,6 @@ public class SplitBCCSendActivity extends SwipeRightActivity implements EntryKey
});
success = false;
}
- tx = null;
- toAddress = null;
- btcAmount = 0;
} catch (Exception e) {
e.printStackTrace();
}
@@ -286,7 +284,7 @@ public class SplitBCCSendActivity extends SwipeRightActivity implements EntryKey
public void run() {
dp.dismiss();
DialogHdSendConfirm dialog = new DialogHdSendConfirm(SplitBCCSendActivity.this,toAddress,
- tx,sendConfirmListener);
+ tx,false,sendConfirmListener);
dialog.show();
dp.setWait();
}
@@ -325,6 +323,9 @@ public class SplitBCCSendActivity extends SwipeRightActivity implements EntryKey
send();
} else {
DropdownMessage.showDropdownMessage(SplitBCCSendActivity.this, getString(R.string.not_bitpie_bcc_address));
+ if (dp.isShowing()) {
+ dp.dismiss();
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -450,10 +451,8 @@ public class SplitBCCSendActivity extends SwipeRightActivity implements EntryKey
final long amount, final String bluetoothMac) {
etAddress.setText(address.toString());
if (amount > 0) {
-// amountCalculatorLink.setBtcAmount(amount);
etPassword.requestFocus();
} else {
-// amountCalculatorLink.requestFocus();
}
validateValues();
}

MODIFY
bither-android/src/net/bither/activity/hot/SplitBccColdWalletSendActivity.java
bither-android/src/net/bither/activity/hot/SplitBccColdWalletSendActivity.java
@@ -16,6 +16,7 @@ import net.bither.bitherj.crypto.SecureCharSequence;
import net.bither.bitherj.db.AbstractDb;
import net.bither.bitherj.qrcode.QRCodeTxTransport;
import net.bither.bitherj.qrcode.QRCodeUtil;
+import net.bither.bitherj.utils.UnitUtil;
import net.bither.bitherj.utils.Utils;
import net.bither.preference.AppSharedPreference;
import net.bither.qrcode.ScanActivity;
@@ -25,7 +26,6 @@ import net.bither.runnable.HandlerMessage;
import net.bither.ui.base.DropdownMessage;
import net.bither.ui.base.dialog.DialogHdSendConfirm;
import net.bither.util.InputParser;
-import net.bither.util.UnitUtilWrapper;
import org.json.JSONObject;
@@ -59,8 +59,8 @@ public class SplitBccColdWalletSendActivity extends SplitBCCSendActivity {
}
protected void initBalance() {
- tvBalance.setText(UnitUtilWrapper.formatValue(getAmount(AbstractDb.txProvider.
- getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO, address.getAddress()))));
+ tvBalance.setText(UnitUtil.formatValue(getAmount(AbstractDb.txProvider.
+ getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO, address.getAddress())),UnitUtil.BitcoinUnit.BTC));
}
protected void sendClicked() {
@@ -81,6 +81,9 @@ public class SplitBccColdWalletSendActivity extends SplitBCCSendActivity {
} else {
DropdownMessage.showDropdownMessage(SplitBccColdWalletSendActivity.this,
getString(R.string.not_bitpie_bcc_address));
+ if (dp.isShowing()) {
+ dp.dismiss();
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -132,7 +135,7 @@ public class SplitBccColdWalletSendActivity extends SplitBCCSendActivity {
tx.setBtc(false);
if (needConfirm) {
DialogHdSendConfirm dialog = new DialogHdSendConfirm
- (SplitBccColdWalletSendActivity.this, toAddress,tx,
+ (SplitBccColdWalletSendActivity.this, toAddress,tx, false,
sendConfirmListener);
dialog.show();
} else {
@@ -229,6 +232,7 @@ public class SplitBccColdWalletSendActivity extends SplitBCCSendActivity {
DropdownMessage.showDropdownMessage(SplitBccColdWalletSendActivity.this,R.string.send_success);
}
});
+ success = true;
} else {
final JSONObject jsonObj = jsonObject.getJSONObject("error");
final int code = jsonObj.getInt("code");
@@ -241,10 +245,6 @@ public class SplitBccColdWalletSendActivity extends SplitBCCSendActivity {
});
success = false;
}
- success = true;
- tx = null;
- toAddress = null;
- btcAmount = 0;
} catch (Exception e) {
e.printStackTrace();
}

MODIFY
bither-android/src/net/bither/adapter/hot/HotAddressFragmentListAdapter.java
bither-android/src/net/bither/adapter/hot/HotAddressFragmentListAdapter.java
@@ -609,7 +609,7 @@ public class HotAddressFragmentListAdapter extends BaseExpandableListAdapter imp
if (!clicked) {
clicked = true;
if (isSplitBCCAddress) {
- if (a.isSyncComplete()) {
+ if (isSyncComplete(a)) {
Intent intent = new Intent(activity, isPrivate ? SplitBCCSendActivity.class :
SplitBccColdWalletSendActivity.class);
intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, position);

MODIFY
bither-android/src/net/bither/ui/base/ObtainBCCListItemView.java
bither-android/src/net/bither/ui/base/ObtainBCCListItemView.java
@@ -13,7 +13,7 @@ import net.bither.R;
import net.bither.bitherj.core.Address;
import net.bither.bitherj.core.AddressManager;
import net.bither.bitherj.db.AbstractDb;
-import net.bither.util.UnitUtilWrapper;
+import net.bither.bitherj.utils.UnitUtil;
import net.bither.util.WalletUtils;
/**
@@ -84,7 +84,7 @@ public class ObtainBCCListItemView extends FrameLayout {
amount = AddressManager.getInstance().getAmount(AbstractDb.
txProvider.getUnspentOutputByBlockNo(BitherSetting.BTCFORKBLOCKNO,address.getAddress()));
}
- tvBalance.setText(UnitUtilWrapper.formatValue(amount));
+ tvBalance.setText(UnitUtil.formatValue(amount, UnitUtil.BitcoinUnit.BTC) + " " + BitherSetting.BCC);
}
public ObtainBCCListItemView(Context context) {

MODIFY
bither-android/src/net/bither/ui/base/dialog/DialogHdSendConfirm.java
bither-android/src/net/bither/ui/base/dialog/DialogHdSendConfirm.java
@@ -23,6 +23,7 @@ import android.content.DialogInterface;
import android.view.View;
import android.widget.TextView;
+import net.bither.BitherSetting;
import net.bither.R;
import net.bither.bitherj.core.Tx;
import net.bither.preference.AppSharedPreference;
@@ -45,6 +46,12 @@ public class DialogHdSendConfirm extends CenterDialog implements DialogInterface
public DialogHdSendConfirm(Context context, String toAddress, Tx tx,
SendConfirmListener listener) {
+ this(context,toAddress,tx,true,listener);
+
+ }
+
+ public DialogHdSendConfirm(Context context, String toAddress, Tx tx, boolean isBtc,
+ SendConfirmListener listener) {
super(context);
this.listener = listener;
setOnDismissListener(this);
@@ -56,17 +63,22 @@ public class DialogHdSendConfirm extends CenterDialog implements DialogInterface
TextView tvFeeSymbol = (TextView) findViewById(R.id.tv_fee_symbol);
View llChange = findViewById(R.id.ll_change);
TextView tvSymbolChange = (TextView) findViewById(R.id.tv_symbol_change);
+ if (isBtc) {
String symbol = AppSharedPreference.getInstance().getBitcoinUnit().name();
tvSymbol.setText(symbol);
tvFeeSymbol.setText(symbol);
tvSymbolChange.setText(symbol);
+ } else {
+ tvSymbol.setText(BitherSetting.BCC);
+ tvFeeSymbol.setText(BitherSetting.BCC);
+ tvSymbolChange.setText(BitherSetting.BCC);
+ }
findViewById(R.id.btn_cancel).setOnClickListener(this);
findViewById(R.id.btn_ok).setOnClickListener(this);
llChange.setVisibility(View.GONE);
tvAddress.setText(WalletUtils.formatHash(toAddress, 4, 24));
tvBtc.setText(UnitUtilWrapper.formatValueWithBold(tx.amountSentToAddress(toAddress)));
tvFee.setText(UnitUtilWrapper.formatValueWithBold(tx.getFee()));
-
}
@Override

fix some prompt to obtain bcc