Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug when time select #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static void tryAccessibilityAnnounce(View view, CharSequence text) {
}
}

@SuppressLint("NewApi")
public static boolean isTouchExplorationEnabled(AccessibilityManager accessibilityManager) {
if (Build.VERSION.SDK_INT >= 14) {
return accessibilityManager.isTouchExplorationEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {

public interface OnValueSelectedListener {
void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance);
void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance, boolean isUp);
}

public RadialPickerLayout(Context context, AttributeSet attrs) {
Expand Down Expand Up @@ -729,7 +730,7 @@ public void run() {
}
}
setValueForItem(getCurrentItemShowing(), value);
mListener.onValueSelected(getCurrentItemShowing(), value, true);
mListener.onValueSelected(getCurrentItemShowing(), value, true, true);
}
}
mDoingMove = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,18 @@ public void onSaveInstanceState(Bundle outState) {
}
}

@Override
public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance, boolean isUp) {
if (pickerIndex == MINUTE_INDEX) {
setMinute(newValue);
if (mCloseOnSingleTapMinute && isUp) {
onDoneButtonClick();
}
} else {
onValueSelected(pickerIndex, newValue, autoAdvance);
}
}

/**
* Called by the picker for updating the header display.
*/
Expand All @@ -372,9 +384,9 @@ public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance)
Utils.tryAccessibilityAnnounce(mTimePicker, announcement);
} else if (pickerIndex == MINUTE_INDEX) {
setMinute(newValue);
if(mCloseOnSingleTapMinute) {
onDoneButtonClick();
}
// if (mCloseOnSingleTapMinute) {
// onDoneButtonClick();
// }
} else if (pickerIndex == AMPM_INDEX) {
updateAmPmDisplay(newValue);
} else if (pickerIndex == ENABLE_PICKER_INDEX) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fourmob.datetimepicker.sample;

import java.util.Calendar;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
Expand All @@ -12,7 +14,6 @@
import com.sleepbot.datetimepicker.time.RadialPickerLayout;
import com.sleepbot.datetimepicker.time.TimePickerDialog;

import java.util.Calendar;

public class MainActivity extends FragmentActivity implements OnDateSetListener, TimePickerDialog.OnTimeSetListener {

Expand Down