Code Monkey home page Code Monkey logo

time-duration-picker's People

Contributors

anishbajpai014 avatar sebkur avatar svenwiegand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

time-duration-picker's Issues

TimeDurationPicker.SavedState does not implement field for Creator interface

Because of this the view restore procedure can crash (for me it started crashing after switching to the android support libraries' Fragments.

For reference, this is the weird Exception that is produced: "java.lang.RuntimeException: Parcel android.os.Parcel@33bc0fc: Unmarshalling unknown type code 3145776 at offset 1340"

Of course the code and the offset may vary depending on your view hierarchy.

This is the correct implementation:
`public static class SavedState extends BaseSavedState {
final String durationInput;

    public SavedState(Parcelable superState, String durationInput) {
        super(superState);
        this.durationInput = durationInput;
    }

    @SuppressWarnings("unused")
    public SavedState(Parcel source) {
        super(source);
        durationInput = source.readString();
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        super.writeToParcel(out, flags);
        out.writeString(durationInput);
    }

    public static final Parcelable.Creator<SavedState> CREATOR
            = new Parcelable.Creator<SavedState>() {
        public SavedState createFromParcel(Parcel in) {
            return new SavedState(in);
        }

        public SavedState[] newArray(int size) {
            return new SavedState[size];
        }
    };
}

The only thing that is changed is the added CREATOR field.

getFragmentManager() is now deprecated

creating a new instance should use getSupportFragmentManager()

new PickerDialogFragment().show(getFragmentManager(), "dialog");

any work arounds available?

How to change durationDisplayBackground of fragment

Apparently when I use the time-duration picker widget as a fragment, it doesn't automatically
use the right textColor. So it's not possible to see the values entered into the dialog as the text color and the background are both white. Is there any way to change the durationDisplayBackground from the java code in my own extension of the TimeDurationPickerDialogFragment? I've already tried to change the style using myFragement.setStyle() but it doesn't seem to work. What am I missing? Thanks a lot!

Implement TimeDurationPickerDialog

I tried to implement the TimeDurationPickerDialog based on the AlertDialog, but when I click the button, the screen is just faded out without showing the TimeDurationPickerDialog. Here is my example code:

durationPicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TimeDurationPickerDialog.Builder durationDialog = new TimeDurationPickerDialog.Builder(CreateEventActivity.this,R.style.AlertDialog); durationDialog.show(); } });

Customization

Hi,

Is there a way to show only hours and minutes? In fact could it be possible to switch units, from hours to minutes or something like that?

Thanks

Returning the duration from the fragment

I'm new to Android dev so this is probably a really easy question, but how does one get the duration from the TimePicker fragment?

I've got the TimePicker.java fragment in the directory with my activity. The activity successfully opens the fragment when the user long clicks on some text, but I can't figure out how to return the duration value from the fragment back to the activity. I spent a few hours yesterday messing around with interfaces but never got it to work.

Size not properly calculated in onMeasure

TimeDurationPicker.onMeasure doesn't properly set the size of the numPad.

// measure the numPad
// if we have more space available, we can try to grow the num pad
final int numPadWidth = Math.max(minNumPadHeight, displayRowWidth);
final int numPadHeight = Math.max(minNumPadHeight, preferredHeight - displayRowHeight);
numPad.measure(MeasureSpec.makeMeasureSpec(numPadWidth, MeasureSpec.EXACTLY), 
MeasureSpec.makeMeasureSpec(numPadHeight, MeasureSpec.EXACTLY));

For the numPadWidth, I think you want minNumPadWidth instead of minNumPadHeight.

However, using Math.max doesn't work properly on smaller screens. If the available screen height is smaller than the minNumPadHeight, the height you set will be too large (similar for width), and the keyboard gets cut of. For example:

LandscapeNoZeros

killing the zeroes.

I'd put in a pull request, but I don't know if this would kill the expected behavior from other users...

Set title and add text to dialog

Is it possible to set the title and prompt text of the TimePickerDialog? I'm sorry if this is a trivial question but I'm new to android development.

Customization of TimeDurationPicker used by TimeDurationPickerPreference

The TimeDurationPicker itself is customizable using XML attributes. The TimeDurationPickerPreference opens a dialog that contains a TimeDurationPicker which could in turn be customized using XML attributes.

As a use case, I have some durations in my preferences.xml that need different appearance (in my case the timeUnits attribute needs to be customized for some of them). I think it would make sense to support most of the styleable attributes from TimeDurationPicker in the TimeDurationPickerPreference.

Bug for RTL languages

screenshot_20180912-101048

Library version: 1.1.3

Called is:
mValueDialog = new TimeDurationPickerDialog(context, new TimeDurationPickerDialog.OnDurationSetListener() { ... }, iValue * 1000, TimeDurationPicker.HH_MM_SS); mValueDialog.show();

Locale is system locale.

Possibility to use support.v4.app.DialogFragment

Hi,

At first, thank you for uploading it, it is a nice component, it saved a lot of time for me. However in my app I'm using supportDialogs and fragments, and I would be good if I can avoid to rewrite my whole application.
Do you have any objections to use support.v4.app.DialogFragment instead of app.DialogFragment?
If there's no any, could you please change your part in here?

Thank you in advance,

Tamás Oarga

Pressing dialog ok without time change resets time

Hi.

I'm using dialog with minutes and seconds
protected int setTimeUnits() { return TimeDurationPicker.MM_SS; }
protected long getInitialDuration() { return 30000 } //30 seconds

  1. Open dialog
  2. Press ok wihtout any changes
  3. Getting duration = 0 in onDurationSet method.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.