Skip to content

Commit

Permalink
Fix issue #8.
Browse files Browse the repository at this point in the history
Fix incorrect backspace drawable.
  • Loading branch information
Stéphane Baiget committed Apr 7, 2017
1 parent f967f48 commit a83c679
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -19,7 +19,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
}
}
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Expand Up @@ -16,7 +16,7 @@

ext {
// Versions
supportVersion = "25.3.0"
supportVersion = "25.3.1"
rxJavaVersion = "2.0.6"
rxAndroidVersion = "2.0.1"
butterknifeVersion = "8.5.1"
Expand Down
Expand Up @@ -128,7 +128,10 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
String result = numberTextView.getText().toString();
if (result.isEmpty()) result = "0";
result = result.replace(',', '.');
if (result.equals(".")) result = "0";

final float number = Float.parseFloat(result);

final Activity activity = getActivity();
final Fragment fragment = getParentFragment();
if (activity instanceof DecimalPickerHandler) {
Expand Down Expand Up @@ -234,6 +237,11 @@ private void onNumberChanged() {
}
}

private void initDecimalSeparator() {
DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
decimalSeparator = "" + formatSymbols.getDecimalSeparator();
}

private void assignArguments(Bundle args) {
if (args.containsKey(ARG_REFERENCE))
reference = args.getInt(ARG_REFERENCE);
Expand All @@ -245,11 +253,6 @@ private void assignArguments(Bundle args) {
theme = args.getInt(ARG_THEME);
}

private void initDecimalSeparator() {
DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
decimalSeparator = "" + formatSymbols.getDecimalSeparator();
}

public static class Builder {

private int reference = DEFAULT_REFERENCE;
Expand Down
Expand Up @@ -61,11 +61,11 @@ public static StateListDrawable makeSelector(Context context, int drawableResId,
StateListDrawable res = new StateListDrawable();
res.setExitFadeDuration(50);
Drawable drawable = ContextCompat.getDrawable(context, drawableResId);
DrawableCompat.setTint(drawable, color);
res.addState(new int[]{android.R.attr.state_enabled}, drawable);
drawable = ContextCompat.getDrawable(context, drawableResId);
DrawableCompat.setTint(drawable, color & 0x40FFFFFF);
res.addState(new int[]{-android.R.attr.state_enabled}, drawable);
drawable = ContextCompat.getDrawable(context, drawableResId);
DrawableCompat.setTint(drawable, color);
res.addState(new int[]{android.R.attr.state_enabled}, drawable);
return res;
}
}
Expand Up @@ -22,7 +22,7 @@
android:viewportWidth="24.0"
>
<path
android:fillColor="#000000"
android:fillColor="#FF000000"
android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.9,0.89 1.59,0.89h15c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM19,15.59L17.59,17 14,13.41 10.41,17 9,15.59 12.59,12 9,8.41 10.41,7 14,10.59 17.59,7 19,8.41 15.41,12 19,15.59z"
/>
</vector>
1 change: 1 addition & 0 deletions library/src/main/res/layout/snp_dialog_decimal_picker.xml
Expand Up @@ -50,6 +50,7 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/snp_margin_padding_size_medium"
tools:src="@drawable/snp_ic_backspace_black_24dp"
/>
</LinearLayout>
Expand Down
Expand Up @@ -50,6 +50,7 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/snp_margin_padding_size_medium"
tools:src="@drawable/snp_ic_backspace_black_24dp"
/>
</LinearLayout>
Expand Down

0 comments on commit a83c679

Please sign in to comment.