Browse Source

fix some ui issue (#18)

dice
JunZhang 4 years ago
committed by GitHub
parent
commit
2511db0e31
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/src/main/java/com/cobo/cold/ui/views/MenuHidingEditText.java
  2. 47
      app/src/main/java/com/cobo/cold/ui/views/StatusBarView.java
  3. BIN
      app/src/main/res/drawable-xhdpi/update_guide.png
  4. 2
      app/src/main/res/layout/add_white_list.xml
  5. 2
      app/src/main/res/layout/manage_coin_fragment.xml
  6. 2
      app/src/main/res/layout/password_input_modal.xml
  7. 12
      app/src/main/res/layout/set_pattern_unlock.xml
  8. 1
      app/src/main/res/values-zh-rCN/strings.xml
  9. 1
      app/src/main/res/values/strings.xml

3
app/src/main/java/com/cobo/cold/ui/views/MenuHidingEditText.java

@ -18,6 +18,7 @@ package com.cobo.cold.ui.views;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.text.InputType;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
@ -61,6 +62,8 @@ public class MenuHidingEditText extends AppCompatEditText {
MenuHidingEditText.this.clearFocus(); MenuHidingEditText.this.clearFocus();
return false; return false;
}); });
setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
setTransformationMethod(null);
} }
@Override @Override

47
app/src/main/java/com/cobo/cold/ui/views/StatusBarView.java

@ -18,36 +18,18 @@
package com.cobo.cold.ui.views; package com.cobo.cold.ui.views;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Color;
import android.os.PowerManager; import android.os.PowerManager;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.cobo.cold.R;
import com.cobo.cold.Utilities;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import static android.content.Context.MODE_PRIVATE;
import static com.cobo.cold.Utilities.PREFERENCE_KEY_BELONG_TO;
import static com.cobo.cold.Utilities.PREFERENCE_SECRET;
public class StatusBarView extends LinearLayout { public class StatusBarView extends LinearLayout {
private static final String TAG = "Vault.StatusBarView"; private static final String TAG = "Vault.StatusBarView";
private final SharedPreferences sp;
private final OnSharedPreferenceChangeListener listener = (sp, key) -> {
if (PREFERENCE_KEY_BELONG_TO.equals(key)) {
updateBg();
}
};
public StatusBarView(Context context) { public StatusBarView(Context context) {
this(context, null); this(context, null);
} }
@ -62,37 +44,8 @@ public class StatusBarView extends LinearLayout {
public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
sp = getContext().getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
updateBg();
} }
private void updateBg() {
String belongTo = Utilities.getCurrentBelongTo(getContext());
if ("hidden".equals(belongTo)) {
setBackgroundColor(Color.parseColor("#FFC700"));
findViewById(R.id.passphrase).setVisibility(VISIBLE);
} else {
setBackgroundColor(Color.TRANSPARENT);
findViewById(R.id.passphrase).setVisibility(GONE);
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
sp.registerOnSharedPreferenceChangeListener(listener);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
sp.unregisterOnSharedPreferenceChangeListener(listener);
}
private boolean isDryCell() { private boolean isDryCell() {
boolean isDryCell = false; boolean isDryCell = false;

BIN
app/src/main/res/drawable-xhdpi/update_guide.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

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

@ -72,7 +72,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="ETH" /> tools:text="ETH" />
<com.cobo.cold.ui.views.NoSuggestionEditText <com.cobo.cold.ui.views.MenuHidingEditText
android:id="@+id/name_edit" android:id="@+id/name_edit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"

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

@ -57,7 +57,7 @@
android:background="#000000" android:background="#000000"
android:visibility="invisible"> android:visibility="invisible">
<com.cobo.cold.ui.views.NoSuggestionEditText <com.cobo.cold.ui.views.MenuHidingEditText
android:id="@+id/search" android:id="@+id/search"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"

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

@ -73,7 +73,7 @@
android:text="@string/factory_reset_hint" android:text="@string/factory_reset_hint"
android:textSize="12sp" /> android:textSize="12sp" />
<com.cobo.cold.ui.views.MenuHidingEditText <EditText
android:id="@+id/input" android:id="@+id/input"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"

12
app/src/main/res/layout/set_pattern_unlock.xml

@ -63,6 +63,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="34dp" android:layout_marginTop="34dp"
android:visibility="gone"
app:step="2" /> app:step="2" />
@ -74,10 +75,17 @@
android:text="@string/pattern_unlock_hint" android:text="@string/pattern_unlock_hint"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pattern_lock_hide_track"
android:textColor="@color/white40"
android:textSize="12sp" />
<TextView <TextView
android:id="@+id/hint1" android:id="@+id/hint1"
android:layout_marginTop="30dp" android:layout_marginTop="16dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/pattern_lock_hint" android:text="@string/pattern_lock_hint"
@ -89,7 +97,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" android:layout_marginHorizontal="20dp"
android:layout_marginTop="35dp" android:layout_marginTop="10dp"
app:aspectRatio="square" app:aspectRatio="square"
app:aspectRatioEnabled="true" app:aspectRatioEnabled="true"
app:correctStateColor="@color/colorAccent" app:correctStateColor="@color/colorAccent"

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

@ -318,4 +318,5 @@
<string name="dice_rolls">骰子生成助记词</string> <string name="dice_rolls">骰子生成助记词</string>
<string name="dice_roll_guide"><![CDATA[请注意:<br><br> 1. 至少投掷50次,才能生成助记词;建议您最少投掷99次,获得256位的随机熵值;Cobo 金库不限制您的最大投掷次数。<br>2. 建议您使用<font color="#00cdc3">赌场级骰子<font/>(六个面向上的概率相同),操作过程中确保骰子在空中得到足够的翻转,且避免总是从骰子特定面朝上进行投掷。]]></string> <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="start">开始</string>
<string name="pattern_lock_hide_track">为防偷窥,解锁时将隐藏轨迹</string>
</resources> </resources>

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

@ -342,4 +342,5 @@
<string name="dice_rolls">Dice Rolls</string> <string name="dice_rolls">Dice Rolls</string>
<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="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="start">Start</string>
<string name="pattern_lock_hide_track">To prevent peeping, track will be hidden when unlocked</string>
</resources> </resources>

Loading…
Cancel
Save