|
@ -1,7 +1,6 @@ |
|
|
package com.henninghall.date_picker; |
|
|
package com.henninghall.date_picker; |
|
|
|
|
|
|
|
|
import android.content.res.Resources; |
|
|
import android.content.res.Resources; |
|
|
import android.support.annotation.Nullable; |
|
|
|
|
|
import android.util.Log; |
|
|
import android.util.Log; |
|
|
import android.util.TypedValue; |
|
|
import android.util.TypedValue; |
|
|
|
|
|
|
|
@ -36,7 +35,7 @@ public class DatePickerManager extends SimpleViewManager { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "mode") |
|
|
@ReactProp(name = "mode") |
|
|
public void setMode(PickerView view, @Nullable String mode) { |
|
|
|
|
|
|
|
|
public void setMode(PickerView view, String mode) { |
|
|
Mode m; |
|
|
Mode m; |
|
|
try { |
|
|
try { |
|
|
m = Mode.valueOf(mode); |
|
|
m = Mode.valueOf(mode); |
|
@ -47,43 +46,43 @@ public class DatePickerManager extends SimpleViewManager { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "date") |
|
|
@ReactProp(name = "date") |
|
|
public void setDate(PickerView view, @Nullable String date) { |
|
|
|
|
|
|
|
|
public void setDate(PickerView view, String date) { |
|
|
this.date = date; |
|
|
this.date = date; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "locale") |
|
|
@ReactProp(name = "locale") |
|
|
public void setLocale(PickerView view, @Nullable String locale) { |
|
|
|
|
|
|
|
|
public void setLocale(PickerView view, String locale) { |
|
|
view.setLocale(LocaleUtils.toLocale(locale.replace('-','_'))); |
|
|
view.setLocale(LocaleUtils.toLocale(locale.replace('-','_'))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "minimumDate") |
|
|
@ReactProp(name = "minimumDate") |
|
|
public void setMinimumDate(PickerView view, @Nullable String date) { |
|
|
|
|
|
|
|
|
public void setMinimumDate(PickerView view, String date) { |
|
|
view.setMinimumDate(date); |
|
|
view.setMinimumDate(date); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "maximumDate") |
|
|
@ReactProp(name = "maximumDate") |
|
|
public void setMaximumDate(PickerView view, @Nullable String date) { |
|
|
|
|
|
|
|
|
public void setMaximumDate(PickerView view, String date) { |
|
|
view.setMaximumDate(date); |
|
|
view.setMaximumDate(date); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "fadeToColor") |
|
|
@ReactProp(name = "fadeToColor") |
|
|
public void setFadeToColor(PickerView view, @Nullable String color) { |
|
|
|
|
|
|
|
|
public void setFadeToColor(PickerView view, String color) { |
|
|
view.style.setFadeToColor(color); |
|
|
view.style.setFadeToColor(color); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "textColor") |
|
|
@ReactProp(name = "textColor") |
|
|
public void setTextColor(PickerView view, @Nullable String color) { |
|
|
|
|
|
|
|
|
public void setTextColor(PickerView view, String color) { |
|
|
view.style.setTextColor(color); |
|
|
view.style.setTextColor(color); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "minuteInterval") |
|
|
@ReactProp(name = "minuteInterval") |
|
|
public void setMinuteInterval(PickerView view, @Nullable int interval) throws Exception { |
|
|
|
|
|
|
|
|
public void setMinuteInterval(PickerView view, int interval) throws Exception { |
|
|
if (interval < 0 || interval > 59) throw new Exception("Minute interval out of bounds"); |
|
|
if (interval < 0 || interval > 59) throw new Exception("Minute interval out of bounds"); |
|
|
view.setMinuteInterval(interval); |
|
|
view.setMinuteInterval(interval); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ReactProp(name = "utc") |
|
|
@ReactProp(name = "utc") |
|
|
public void setUtc(PickerView view, @Nullable boolean utc) throws Exception { |
|
|
|
|
|
|
|
|
public void setUtc(PickerView view, boolean utc) throws Exception { |
|
|
TimeZone timeZone = utc ? TimeZone.getTimeZone("UTC") : TimeZone.getDefault(); |
|
|
TimeZone timeZone = utc ? TimeZone.getTimeZone("UTC") : TimeZone.getDefault(); |
|
|
view.setTimeZone(timeZone); |
|
|
view.setTimeZone(timeZone); |
|
|
} |
|
|
} |
|
|