support backup bitpie cold connector account.
support clone bipei cold connector account.
MODIFY
bither-android/src/net/bither/activity/cold/ColdActivity.java
bither-android/src/net/bither/activity/cold/ColdActivity.java
@@ -35,6 +35,7 @@ import net.bither.R;
import net.bither.adapter.cold.ColdFragmentPagerAdapter;
import net.bither.bitherj.core.Address;
import net.bither.bitherj.core.AddressManager;
+import net.bither.bitherj.core.BitpieHDAccountCold;
import net.bither.bitherj.core.HDAccountCold;
import net.bither.bitherj.core.HDMKeychain;
import net.bither.bitherj.crypto.ECKey;
@@ -428,8 +429,12 @@ public class ColdActivity extends BaseFragmentActivity {
if (mnemonicCode != null && MnemonicWordList.getMnemonicWordListForHdSeed(keyString).equals(mnemonicCode.getMnemonicWordList())) {
try {
String[] passwordSeeds = QRCodeUtil.splitOfPasswordSeed(keyString);
- String encreyptString = Utils.joinString(new String[]{passwordSeeds[1], passwordSeeds[2], passwordSeeds[3]}, QRCodeUtil.QR_CODE_SPLIT);
- new HDAccountCold(mnemonicCode, new EncryptedData(encreyptString), password);
+ String encryptString = Utils.joinString(new String[]{passwordSeeds[1], passwordSeeds[2], passwordSeeds[3]}, QRCodeUtil.QR_CODE_SPLIT);
+ if (MnemonicWordList.isHDQrCode(keyString)) {
+ new HDAccountCold(mnemonicCode, new EncryptedData(encryptString), password);
+ } else if (MnemonicWordList.isBitpieQrCode(keyString)) {
+ new BitpieHDAccountCold(mnemonicCode, new EncryptedData(encryptString), password);
+ }
AppSharedPreference.getInstance().setMnemonicWordList(mnemonicCode.getMnemonicWordList());
MnemonicCode.setInstance(mnemonicCode);
} catch (Exception e) {
@@ -524,7 +529,9 @@ public class ColdActivity extends BaseFragmentActivity {
}
if (AddressManager.getInstance().getPrivKeyAddresses() != null && AddressManager
.getInstance().getPrivKeyAddresses().size() == 0 && AddressManager
- .getInstance().getHdmKeychain() == null && !AddressManager.getInstance().hasHDAccountCold()) {
+ .getInstance().getHdmKeychain() == null
+ && !AddressManager.getInstance().hasHDAccountCold()
+ && !AddressManager.getInstance().hasBitpieHDAccountCold()) {
checkBackup();
}
}

MODIFY
bither-android/src/net/bither/fragment/cold/CheckFragment.java
bither-android/src/net/bither/fragment/cold/CheckFragment.java
@@ -42,7 +42,6 @@ import net.bither.bitherj.BitherjSettings;
import net.bither.bitherj.core.Address;
import net.bither.bitherj.core.AddressManager;
import net.bither.bitherj.core.HDAccount;
-import net.bither.bitherj.core.HDAccountCold;
import net.bither.bitherj.crypto.SecureCharSequence;
import net.bither.bitherj.utils.Utils;
import net.bither.model.Check;

MODIFY
bither-android/src/net/bither/fragment/cold/ColdAddressFragment.java
bither-android/src/net/bither/fragment/cold/ColdAddressFragment.java
@@ -47,8 +47,10 @@ import net.bither.ui.base.dialog.DialogPassword;
import net.bither.ui.base.dialog.DialogProgress;
import net.bither.ui.base.dialog.DialogSimpleQr;
import net.bither.ui.base.listener.IDialogPasswordListener;
+import net.bither.util.FileUtil;
import net.bither.util.ThreadUtil;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -72,6 +74,13 @@ public class ColdAddressFragment extends Fragment implements Refreshable,
View view = inflater.inflate(R.layout.fragment_cold_address, container,
false);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ FileUtil.getBackupFileListOfCold();
+ FileUtil.getBackupFileOfCold();
+ }
+ });
lvPrivate = (ListView) view.findViewById(R.id.lv_address);
ivNoAddress = view.findViewById(R.id.iv_no_address);
privates = new ArrayList<Address>();

MODIFY
bither-android/src/net/bither/fragment/cold/OptionColdFragment.java
bither-android/src/net/bither/fragment/cold/OptionColdFragment.java
@@ -47,6 +47,7 @@ import net.bither.activity.cold.ColdAdvanceActivity;
import net.bither.activity.cold.SignTxActivity;
import net.bither.bitherj.core.Address;
import net.bither.bitherj.core.AddressManager;
+import net.bither.bitherj.core.BitpieHDAccountCold;
import net.bither.bitherj.core.EnterpriseHDMSeed;
import net.bither.bitherj.core.HDAccountCold;
import net.bither.bitherj.core.HDMKeychain;
@@ -258,8 +259,10 @@ public class OptionColdFragment extends Fragment implements Selectable {
}
private void configureCloneButton() {
- if ((AddressManager.getInstance().getPrivKeyAddresses() != null && AddressManager.getInstance().getPrivKeyAddresses()
- .size() > 0) || AddressManager.getInstance().hasHDMKeychain() || AddressManager.getInstance().hasHDAccountCold()) {
+ if ((AddressManager.getInstance().getPrivKeyAddresses() != null && AddressManager.getInstance().getPrivKeyAddresses().size() > 0)
+ || AddressManager.getInstance().hasHDMKeychain()
+ || AddressManager.getInstance().hasHDAccountCold()
+ || AddressManager.getInstance().hasBitpieHDAccountCold()) {
btnCloneFrom.setVisibility(View.GONE);
btnCloneTo.setVisibility(View.VISIBLE);
} else {
@@ -496,6 +499,7 @@ public class OptionColdFragment extends Fragment implements Selectable {
List<Address> addressList = PrivateKeyUtil.getECKeysFromBackupString(content, password);
HDMKeychain hdmKeychain = PrivateKeyUtil.getHDMKeychain(content, password);
HDAccountCold hdAccountCold = null;
+ BitpieHDAccountCold bitpieHDAccountCold = null;
MnemonicWordList mnemonicWordList = MnemonicWordList.getMnemonicWordListForHdSeed(content);
MnemonicCode mnemonicCode = null;
if (mnemonicWordList != null) {
@@ -503,13 +507,14 @@ public class OptionColdFragment extends Fragment implements Selectable {
mnemonicCode = new MnemonicCodeAndroid();
mnemonicCode.setMnemonicWordList(mnemonicWordList);
hdAccountCold = PrivateKeyUtil.getHDAccountCold(mnemonicCode, content, password);
+ bitpieHDAccountCold = PrivateKeyUtil.getBitpieHDAccountCould(mnemonicCode, content, password);
} catch (IOException e) {
e.printStackTrace();
}
}
if ((addressList == null || addressList.size() == 0) && (hdmKeychain == null) &&
- hdAccountCold == null) {
+ hdAccountCold == null && bitpieHDAccountCold == null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -523,8 +528,9 @@ public class OptionColdFragment extends Fragment implements Selectable {
});
return;
}
-
+ if (addressList != null) {
KeyUtil.addAddressListByDesc(null, addressList);
+ }
if (hdmKeychain != null) {
KeyUtil.setHDKeyChain(hdmKeychain);
}

MODIFY
bitherj
bitherj
-Subproject commit 6f628327671e300452fb63a69e16b97c7f1759ea
+Subproject commit 0c959059df17ec883f228f609ffc8cf435039338

support backup bitpie cold connector account.
support clone bipei cold connector account.