public void setHideTime(boolean enable, final boolean useDarkTheme) {
        if(enable && !shouldHideTime) {
            // hide the time spinner and show a button to show it instead
            timeSpinner.setVisibility(GONE);
            ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null);
            timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light);
            timeButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    setHideTime(false, useDarkTheme);
                }
            });
            this.addView(timeButton);
        } else if(!enable && shouldHideTime) {
            timeSpinner.setVisibility(VISIBLE);
            this.removeViewAt(2);
        }
        shouldHideTime = enable;
    }
public void setHideTime ( boolean enable , final boolean useDarkTheme ) { if ( enable && ! shouldHideTime ) { timeSpinner . setVisibility ( GONE ) ; ImageButton timeButton = ( ImageButton ) LayoutInflater . from ( getContext ( ) ) . inflate ( R . layout . time_button , null ) ; timeButton . setImageResource ( useDarkTheme ? R . drawable . ic_action_time_dark : R . drawable . ic_action_time_light ) ; timeButton . setOnClickListener ( new OnClickListener ( ) { @ Override public void onClick ( View v ) { setHideTime ( false , useDarkTheme ) ; } } ) ; this . addView ( timeButton ) ; } else if ( ! enable && shouldHideTime ) { timeSpinner . setVisibility ( VISIBLE ) ; this . removeViewAt ( 2 ) ; } shouldHideTime = enable ; }
Toggles hiding the Time Spinner and replaces it with a Button.
@param enable True to hide the Spinner, false to show it.
@param useDarkTheme True if a white icon shall be used, false for a dark one.