@@ -0,0 +1,2900 @@
+package com.philliphsu.bottomsheetpickers.view;%0A%0Aimport android.support.annotation.NonNull;%0Aimport android.view.View;%0Aimport android.widget.TextView;%0A%0A/**%0A * Controller that manages the UI states of a number pad time picker.%0A */%0Afinal class NumberPadTimePickerController %7B%0A    private static final int MAX_CHARS = 8;%0A%0A    // (M)odel: Simply stores data and provides us access to that data.%0A    private final TimeModel mTimeModel = new TimeModel();%0A%0A    // Objects used by the (C)ontroller to format/process the data from the model%0A    // for consumption by the end user.%0A    private final StringBuilder mTimeFormatter = new StringBuilder(MAX_CHARS);%0A%0A    // (V)iews%0A    private final NumberPadTimePickerView mNumberPadView;%0A    private final TextView mTimeDisplayView;%0A    private final View mBackspaceButton;%0A    private final View mOkButton;%0A%0A    public NumberPadTimePickerController(@NonNull NumberPadTimePickerView numberPadView,%0A                                         @NonNull TextView timeDisplayView,%0A                                         @NonNull View backspaceButton,%0A                                         @NonNull View okButton) %7B%0A        mNumberPadView = numberPadView;%0A        mTimeDisplayView = timeDisplayView;%0A        mBackspaceButton = backspaceButton;%0A        mOkButton = okButton;%0A    %7D%0A%0A    void onButtonClick(TextView button) %7B%0A        final String text = button.getText().toString();%0A        try %7B%0A            mTimeModel.storeDigit(Integer.parseInt(text));%0A        %7D catch (NumberFormatException e) %7B%0A            // TODO: This is either an AM/PM state, or an alt button.%0A        %7D%0A        updateViews();%0A    %7D%0A%0A    void onBackspaceClick() %7B%0A        mTimeModel.removeDigit();%0A        updateViews();%0A    %7D%0A%0A    private void updateViews() %7B%0A        // TODO: Update number key states.%0A        // TODO: Update backspace state.%0A        // TODO: Update ok button state.%0A        // TODO: Format text for display and update time display view.%0A    %7D%0A%0A    /**%0A     * Model that encapsulates data pertaining to the inputted time.%0A     * The data is insignificant enough that we can make the model%0A     * an inner class of the controller.%0A     */%0A    private static class TimeModel %7B%0A        private static final int AM = 0;%0A        private static final int PM = 1;%0A        private static final int NOT_APPLICABLE = -1;%0A%0A        private final int%5B%5D mDigits = new int%5B4%5D;%0A%0A        private int mTimeState;%0A%0A        private void storeDigit(int digit) %7B%0A            int i = -1; // TODO: keep track of our %22cursor%22%0A            mDigits%5Bi%5D = digit;%0A            i++;%0A        %7D%0A%0A        private int getDigit(int at) %7B%0A            return mDigits%5Bat%5D;%0A        %7D%0A%0A        private void removeDigit() %7B%0A            int i = -1; // TODO: keep track of our %22cursor%22%0A            if (i %3E 0) %7B%0A                i--; // move the cursor back%0A                mDigits%5Bi%5D = -1;%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Write preliminary implementation of NumberPadTimePickerController.