Browse Source

fix some ui issues (#38)

V1.2.0-btc-release
JunZhang 4 years ago
committed by GitHub
parent
commit
e5e83f472b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      app/src/main/java/com/cobo/cold/ui/fragment/main/QRCodeScanFragment.java
  2. 20
      app/src/main/java/com/cobo/cold/ui/fragment/main/TxListFragment.java
  3. 2
      app/src/main/java/com/cobo/cold/ui/fragment/main/WalletInfoFragment.java
  4. 2
      app/src/main/java/com/cobo/cold/ui/fragment/main/electrum/ExportXpubGuideFragment.java
  5. 40
      app/src/main/res/layout/export_xpub_guide.xml
  6. 2
      app/src/main/res/layout/qrcode_scan_fragment.xml
  7. 2
      app/src/main/res/layout/setup_watch_wallet.xml
  8. 3
      app/src/main/res/layout/tx_list.xml
  9. 22
      app/src/main/res/layout/wallet_info.xml
  10. 16
      app/src/main/res/values-zh-rCN/strings.xml
  11. 43
      app/src/main/res/values/strings.xml

18
app/src/main/java/com/cobo/cold/ui/fragment/main/QRCodeScanFragment.java

@ -86,9 +86,7 @@ public class QRCodeScanFragment extends BaseFragment<QrcodeScanFragmentBinding>
@Override
protected void init(View view) {
watchWallet = getWatchWallet(mActivity);
if (watchWallet != ELECTRUM) {
mBinding.electrumScanHint.setVisibility(View.GONE);
}
mBinding.scanHint.setText(getScanhint());
boolean isSetupVault = getArguments() != null && getArguments().getBoolean(IS_SETUP_VAULT);
purpose = getArguments() != null ? getArguments().getString("purpose") : "";
mBinding.toolbar.setNavigationOnClickListener(v -> navigateUp());
@ -102,10 +100,22 @@ public class QRCodeScanFragment extends BaseFragment<QrcodeScanFragmentBinding>
QrScanViewModel.Factory factory = new QrScanViewModel.Factory(mActivity.getApplication(), isSetupVault);
viewModel = ViewModelProviders.of(this, factory).get(QrScanViewModel.class);
if (!TextUtils.isEmpty(purpose)) {
mBinding.electrumScanHint.setVisibility(View.GONE);
mBinding.scanHint.setVisibility(View.GONE);
}
}
public String getScanhint() {
switch (watchWallet){
case ELECTRUM:
return getString(R.string.scan_electrum_hint);
case BLUE:
return getString(R.string.scan_blue_hint);
case WASABI:
return getString(R.string.scan_wasabi_hint);
}
return "";
}
@Override
public void onResume() {
super.onResume();

20
app/src/main/java/com/cobo/cold/ui/fragment/main/TxListFragment.java

@ -96,7 +96,13 @@ public class TxListFragment extends BaseFragment<TxListBinding> {
.filter(this::filterByMode)
.sorted(txEntityComparator)
.collect(Collectors.toList());
adapter.setItems(txEntities);
if (txEntities.isEmpty()) {
showEmpty(true);
} else {
showEmpty(false);
adapter.setItems(txEntities);
}
});
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
@ -113,6 +119,18 @@ public class TxListFragment extends BaseFragment<TxListBinding> {
});
}
private void showEmpty(boolean empty) {
if (empty) {
mBinding.list.setVisibility(View.GONE);
mBinding.txid.setVisibility(View.GONE);
mBinding.empty.setVisibility(View.VISIBLE);
} else {
mBinding.list.setVisibility(View.VISIBLE);
mBinding.txid.setVisibility(View.VISIBLE);
mBinding.empty.setVisibility(View.GONE);
}
}
private boolean filterByMode(TxEntity txEntity) {
WatchWallet watchWallet = WatchWallet.getWatchWallet(mActivity);
switch (watchWallet) {

2
app/src/main/java/com/cobo/cold/ui/fragment/main/WalletInfoFragment.java

@ -90,7 +90,7 @@ public class WalletInfoFragment extends BaseFragment<WalletInfoBinding> {
private void switchAddressFormat() {
Bundle data = new Bundle();
data.putInt(KEY_TITLE, R.string.select_address_format);
data.putInt(KEY_TITLE, R.string.toggle_address_format);
navigate(R.id.action_to_selectAddressFormatFragment, data);
}

2
app/src/main/java/com/cobo/cold/ui/fragment/main/electrum/ExportXpubGuideFragment.java

@ -58,8 +58,8 @@ public class ExportXpubGuideFragment extends BaseFragment<ExportXpubGuideBinding
mBinding.export.setOnClickListener(v -> export());
if (mActivity instanceof MainActivity) {
mBinding.skip.setOnClickListener( v -> popBackStack(R.id.assetFragment,false));
} else {
mBinding.skip.setText(R.string.export_later);
mBinding.skip.setOnClickListener(v -> navigate(R.id.action_to_setupCompleteFragment));
}

40
app/src/main/res/layout/export_xpub_guide.xml

@ -52,7 +52,8 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
@ -85,26 +86,25 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/export"
style="@style/AcceptButton"
android:layout_width="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="0dp"
android:text="@string/export_xpub" />
<TextView
android:id="@+id/skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dp"
android:text="@string/skip_export"
android:textColor="@color/colorAccent" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/export"
style="@style/AcceptButton"
android:layout_width="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="0dp"
android:text="@string/export_xpub" />
<TextView
android:id="@+id/skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dp"
android:text="@string/skip_export"
android:textColor="@color/colorAccent" />
</LinearLayout>
</layout>

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

@ -86,7 +86,7 @@
android:text="@string/scan_hint" />
<TextView
android:id="@+id/electrum_scan_hint"
android:id="@+id/scan_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/align_hint"

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

@ -80,7 +80,7 @@
android:layout_width="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="16dp"
android:text="@string/complete" />
android:text="@string/confirm" />
</LinearLayout>

3
app/src/main/res/layout/tx_list.xml

@ -46,6 +46,7 @@
android:textSize="15sp" />
</androidx.appcompat.widget.Toolbar>
<TextView
android:id="@+id/txid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white40"
@ -69,7 +70,7 @@
android:textColor="@color/white"
android:gravity="center"
android:paddingBottom="200dp"
android:text="@string/tx_list_empty"
android:text="@string/no_signatures"
android:visibility="gone" />
</LinearLayout>
</layout>

22
app/src/main/res/layout/wallet_info.xml

@ -200,7 +200,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="120dp">
android:layout_height="160dp">
<TextView
android:id="@+id/xpub_label"
@ -224,21 +224,17 @@
android:textColor="@color/white"
android:textSize="14sp"
tools:text="ypub6WizmVHgZZHMNUtq4T84HzzrTakvdpwUzsmSsFT4ZaRoJpavKYmZweKd1A4aDZz3p51KMPbWwfii9UMnUKvsXgVFdmQrgPYhy7APibMeT3Z" />
<include
layout="@layout/divider"
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true" />
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:layout_marginHorizontal="16dp"
android:layout_below="@id/xpub"
android:textSize="13sp"
android:text="@string/wallet_info_hint"/>
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:layout_margin="16dp"
android:textSize="13sp"
android:text="@string/wallet_info_hint"/>
</LinearLayout>
</layout>

16
app/src/main/res/values-zh-rCN/strings.xml

@ -269,7 +269,12 @@
</string-array>
<string name="export_to_electrum">在 Electrum 创建观察钱包</string>
<string name="export_to_electrum_guide"><![CDATA[
1. 打开 Electrum,新建钱包 <br>2. 选择“标准钱包” <br>3. 选择“使用主公钥” <br>4. 在输入主公钥页面点击照相机按钮,扫描主公钥二维码(点击下方按钮查看二维码)<br>5. 设置钱包密码 <br>6. 进入观察钱包
1. 打开 Electrum,新建钱包 <br>
2. 选择“标准钱包” <br>
3. 选择“使用主公钥” <br>
4. 在输入主公钥页面点击照相机按钮,扫描主公钥二维码(点击下方按钮查看二维码)<br>
5. 设置钱包密码 <br>
6. 进入观察钱包
]]></string>
<string name="export_xpub">查看主公钥二维码</string>
<string name="export_to_electrum_guide_hint">Electrum 创建指引</string>
@ -327,6 +332,7 @@
<string name="dice_roll_guide"><![CDATA[请注意:<br><br> 1. 至少投掷50次,才能生成助记词;建议您最少投掷99次,获得256位的随机熵值;Cobo 金库不限制您的最大投掷次数。<br>2. 建议您使用<font color="#00cdc3">赌场级骰子<font/>(六个面向上的概率相同),操作过程中确保骰子在空中得到足够的翻转,且避免总是从骰子特定面朝上进行投掷。]]></string>
<string name="start">开始</string>
<string name="pattern_lock_hide_track">为防偷窥,解锁时将隐藏轨迹</string>
<string name="toggle_address_format">切换地址格式</string>
<string name="select_address_format">选择地址格式</string>
<string name="select_address_num">选择数量(%s)</string>
<string name="change_address">找零地址</string>
@ -362,7 +368,7 @@
4. 打开 Cobo 金库导出的钱包文件(点击下方按钮导出)<br>
5. 点击<font color="#00cdc3">“Load Wallet”<font/> <br>
6. 加载完成后即可进入观察钱包<br><br>
请确保 Cobo 金库装有TF卡后再进行导出(仅支持FAT32格式,容量不能超过32G)
<font color="#808080">请确保 Cobo 金库装有TF卡后再进行导出(仅支持FAT32格式,容量不能超过32G)<font/>
]]></string>
<string name="export_xpub_guide_text2_blue"><![CDATA[
@ -378,6 +384,7 @@
<string name="nested_segwit">隔离见证兼容</string>
<string name="txid">交易ID</string>
<string name="skip_export">已导出 / 暂不导出</string>
<string name="export_later">暂不导出</string>
<string name="choose_watch_only_wallet">选择观察钱包</string>
<string name="watch_only_wallet">观察钱包</string>
<string name="switch_watch_only_wallet_guide">切换观察钱包可前往【菜单--设置--选择观察钱包】</string>
@ -414,10 +421,13 @@
</string-array>
<string name="abnormal_tx">异常交易</string>
<string name="fee_attack_warning">检测到该笔交易有风险,不能对其签名,您可前往:https://cobo.com/hardware-wallet/XXX 了解详情,您也可邮件联系客服:support@cobo.com</string>
<string name="fee_attack_warning">检测到该笔交易存在费用超付攻击风险,禁止对其签名,您可前往:https://cobo.com/hardware-wallet/fee-attack 了解详情,您也可邮件联系客服:support@cobo.com</string>
<string name="already_signed">检测到您已对该笔交易签名,您可直接广播该交易</string>
<string name="scan_with_blue_wallet">请用 BlueWallet 扫描二维码</string>
<string name="blue_wallet_broadcast_guide">BlueWallet 广播交易引导</string>
<string name="blue_wallet_broadcast_guide1">在BlueWallet侧打开该观察钱包,进入钱包详情,点击广播交易后,扫描 Cobo 金库的二维码</string>
<string name="no_signatures">暂无签名记录</string>
<string name="scan_blue_hint">若扫描 BlueWallet 动态二维码困难,您可扫描分页二维码</string>
<string name="scan_wasabi_hint">Wasabi Wallet 暂不支持将交易导成二维码,您可将待签交易导出成文件</string>
</resources>

43
app/src/main/res/values/strings.xml

@ -31,7 +31,7 @@
<string name="drawer_menu_about">About Cobo Vault</string>
<string name="title_about">About Cobo Vault</string>
<string name="title_setting">Settings</string>
<string name="title_sync">Sync Cobo Vault Mobile</string>
<string name="title_sync">Export to Cobo Vault Watch-Only</string>
<string name="add_remove_coin">Add / Hide Assets</string>
<string name="scan">Scan QR Code</string>
<string name="scan_hint">Align QR Code within frame to scan</string>
@ -102,8 +102,8 @@
</string-array>
<string-array name="address_format_subtitle" translatable="false">
<item><![CDATA[eg. <font color="#00cdc3">3<font/>kgdahdkhghahdgkhaldshg]]></item>
<item><![CDATA[eg. <font color="#00cdc3">bc1<font/>akjhdfhkashdhdhsaghlh]]></item>
<item><![CDATA[eg. <font color="#00cdc3">3<font/>7VucYSaXLCAsxYyAPfbSi9eh4iEcbShgf]]></item>
<item><![CDATA[eg. <font color="#00cdc3">bc1<font/>qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu]]></item>
</string-array>
<string-array name="address_format_value" translatable="false">
@ -225,7 +225,7 @@
<string name="broadcast_tx">Broadcast Transaction</string>
<string name="please_broadcast_with_hot">Scan QR code with Cobo Vault Mobile to broadcast the transaction to the blockchain</string>
<string name="please_confirm">Please Confirm</string>
<string name="know">I Understand</string>
<string name="know">Understood</string>
<string name="creating_vault_hint">Creating Vault, please keep screen on.</string>
<string name="delete_white_list">Delete White List</string>
<string name="self_check_under_disassemble">Someone has attempted to hack your device!</string>
@ -361,13 +361,13 @@
<string name="export_xpub_text_file">Export Master Public Key File</string>
<string name="file_name_label">File name:</string>
<string name="master_xpub">Master Public Key (%s)</string>
<string name="electrum_qrcode_hint"><![CDATA[Difficulty scanning?Tap the QR code to enlarge<br>or <u>touch here to export the file with microSD</u>.]]></string>
<string name="generic_qrcode_hint"><![CDATA[Difficulty scanning?Tap the QR code to enlarge<br>No scanning? <u>touch here to export the file with microSD</u>.]]></string>
<string name="electrum_qrcode_hint"><![CDATA[Difficulty scanning? Tap the QR code to enlarge<br>or <u>touch here to export the file with microSD</u>.]]></string>
<string name="generic_qrcode_hint"><![CDATA[Difficulty scanning?Tap the QR code to enlarge<br>No scanning? <u>Touch here to export the file with microSD</u>.]]></string>
<string name="scan_electrum_hint">Difficulty scanning? You can import pending transactions from Electrum using a microSD card (Menu > MicroSD Card).</string>
<string name="sign_txn_in_sdcard">Unsigned Transaction Files</string>
<string name="master_pubkey_not_match">Transaction not recognized. Your Cobo Vault has not been successfully paired with the watch-only wallet.</string>
<string name="change">Change</string>
<string name="electrum_compatibility">Electrum Watch-Only Wallet</string>
<string name="electrum_compatibility">Export to Electrum Watch-Only</string>
<string name="generic_compatibility">Generic Wallet</string>
<string name="identification_failed">Identification Failed</string>
<string name="from_electrum">From Electrum</string>
@ -383,8 +383,9 @@
<string name="dice_roll_guide"><![CDATA[How to use dice to generate keys:<br><br> 1. Roll the dice at least 50 times. Roll 99 times to obtain 256-bit entropy (recommended). There is no limit to the number of rolls you can use.<br>2. We recommend you use <font color="#00cdc3">casino dice<font/> to increase the entropy of each dice throw.]]></string>
<string name="start">Start</string>
<string name="pattern_lock_hide_track">Trace marks are hidden to prevent your password from being stolen by an onlooker.</string>
<string name="select_address_format">Toggle Address Type</string>
<string name="select_address_num">Select number of %s</string>
<string name="toggle_address_format">Toggle Address Type</string>
<string name="select_address_format">Select Address Type</string>
<string name="select_address_num">Select number of %s addresses</string>
<string name="change_address">Change Address</string>
<string name="export_xpub_guide_title_electrum">Export to Electrum Watch-Only</string>
<string name="export_xpub_guide_title_wasabi">Export to Wasabi Watch-Only</string>
@ -409,26 +410,26 @@
3. Touch <font color="#00cdc3">“Display QR Code”<font/> below then scan the OR code with the Cobo Vault mobile app. <br><br>
Cobo Vault mobile app download:<br>
<font color="#00cdc3">https://cobo.com/hardware-wallet/downloads<font/><br>
Cobo Vault mobile app requires the xPub, firmware version, derivation path, and assets to be used as a watch-only wallet. This information will be exported if you touch “Display QR Code” below.
<font color="#808080">Cobo Vault mobile app requires the xPub, firmware version to be used as a watch-only wallet. This information will be exported if you touch “Display QR Code” below.<font/>
]]></string>
<string name="export_xpub_guide_text2_wasabi"><![CDATA[
1. Open Wasabi and create a new wallet. <br>
2. Choose <font color="#00cdc3">“Hardware Wallet”<font/>. <br>
3. Choose <font color="#00cdc3">“Import Hardware Wallet”<font/>. <br>
4. Insert a microSD card, then touch <font color="#00cdc3">"Export with MicroSD"<font/> below. <br>
4. Insert a microSD card, then touch <font color="#00cdc3">"Export Wallet"<font/> below. <br>
5. Migrate the wallet file to your computer using the microSD card. <br>
6. Click <font color="#00cdc3">“Load Wallet”<font/> and open the file in Wadabi.<br>
6. Click <font color="#00cdc3">“Load Wallet”<font/> and open the file in Wasabi.<br>
7. Enter the watch-only wallet.<br><br>
Please make sure you have inserted a FAT32 format microSD card with capacity 32GB or less before exporting.<br>
Wasabi requires the xPub, hardware wallet fingerprint, and firmware version to be used as a watch-only wallet. This information will be exported if you touch “Export with MicroSD” below.
<font color="#808080">Please make sure you have inserted a FAT32 format microSD card with capacity 32GB or less before exporting.<br>
Wasabi requires the xPub, hardware wallet fingerprint, and firmware version to be used as a watch-only wallet. This information will be exported if you touch “Export with MicroSD” below.<font/>
]]></string>
<string name="export_xpub_guide_text2_blue"><![CDATA[
1. Open BlueWallet and add a new wallet.<br>
2. Choose “Import Wallet”.
2. Choose “Import Wallet”.<br>
3. Touch <font color="#00cdc3">“Display QR Code”<font/> below, then touch "Scan or import file" in BlueWallet to scan the QR code that displays on Cobo Vault.<br><br>
BlueWallet requires the xPub, wallet type, hardware wallet type and fingerprint, and derivation path to be used as a watch-only wallet. This information will be exported if you touch “Display QR Code” below.
<font color="#808080">BlueWallet requires the zPub, wallet type, hardware wallet fingerprint, and firmware version to be used as a watch-only wallet. This information will be exported if you touch “Display QR Code” below.<font/>
]]></string>
<string name="show_master_public_key_qrcode">Display Master Public Key QR Code</string>
<string name="show_qrcode">Display QR Code</string>
@ -438,9 +439,10 @@
<string name="nested_segwit">Nested SegWit</string>
<string name="txid">TxID</string>
<string name="skip_export">Exported / Export Later</string>
<string name="export_later">Export Later</string>
<string name="choose_watch_only_wallet">Select a watch-only wallet</string>
<string name="watch_only_wallet">Watch-only Wallet</string>
<string name="switch_watch_only_wallet_guide">Go to Menu > Settings > Select Watch-Only Wallet</string>
<string name="switch_watch_only_wallet_guide">Go to Menu > Settings > Watch-Only Wallet to switch</string>
<string name="wallet_info">Wallet Info</string>
<string name="wallet">Key Fingerprint:</string>
<string name="addressType">Address Type:</string>
@ -457,11 +459,14 @@
<string name="toggle_address_hint">Once you toggle the address format, your receiving addresses, exported wallet, and wallet info will all be changed to this format. You will need to export your wallet information again using the new address format if you have not already. Do you still want to change the format?</string>
<string name="toggle_later">Cancel</string>
<string name="toggle_confirm">Confirm</string>
<string name="abnormal_tx">Abnormal Transaction</string>
<string name="fee_attack_warning">Detect that the transaction is risky and cannot be signed. You can go to: https// for details, or contact us: support@cobo.com</string>
<string name="abnormal_tx">Possible Fee Attack</string>
<string name="fee_attack_warning">We detected something strange about this transaction and have prevented it from being signed to protect you. Please visit https://cobo.com/hardware-wallet/fee-attack for details, or contact us at support@cobo.com.</string>
<string name="already_signed">You have signed the transaction, can broadcast the transaction directly</string>
<string name="scan_with_blue_wallet">Scan QR code using BlueWallet</string>
<string name="blue_wallet_broadcast_guide">How to broadcast using BlueWallet</string>
<string name="blue_wallet_broadcast_guide1">Open the Watch-only wallet in BlueWallet, enter wallet information, touch "Broadcast transaction" and scan the QR code of Cobo Vault</string>
<string name="no_signatures">No Signatures</string>
<string name="scan_blue_hint">Difficulty scanning with BlueWallet? Try scanning these static QR codes instead of the single dynamic QR code.</string>
<string name="scan_wasabi_hint">Wasabi Wallet does not support exporting transactions by QR code. Please export transactions using microSD.</string>
</resources>

Loading…
Cancel
Save