Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d8b0bb6 authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Diego Perez
Browse files

Add tools attributes to set extreme values for NumberPicker

tools:minValue and tools:maxValue can now be used to specify
the min and max values of a NumberPicker in the layout editor.

Bug: http://b.android.com/205084
Change-Id: I10037726346c82ca3cf84d255727b84a12ac0349
(cherry picked from commit 3c2b1c65c907fa4f2cae102507688fd0bffd1b24)
parent 4a1bd499
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.annotation.NonNull;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.NumberPicker;

import java.io.File;
import java.util.HashMap;
@@ -300,6 +301,17 @@ public final class BridgeInflater extends LayoutInflater {
                    getDrawerLayoutMap().put(view, attrVal);
                }
            }
            else if (view instanceof NumberPicker) {
                NumberPicker numberPicker = (NumberPicker) view;
                String minValue = attrs.getAttributeValue(BridgeConstants.NS_TOOLS_URI, "minValue");
                if (minValue != null) {
                    numberPicker.setMinValue(Integer.parseInt(minValue));
                }
                String maxValue = attrs.getAttributeValue(BridgeConstants.NS_TOOLS_URI, "maxValue");
                if (maxValue != null) {
                    numberPicker.setMaxValue(Integer.parseInt(maxValue));
                }
            }

        }
    }