mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-18 14:31:23 +02:00
use spinner date dialog, see issue #529
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.health.openscale.gui.views;
|
package com.health.openscale.gui.views;
|
||||||
|
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -94,15 +95,17 @@ public class DateMeasurementView extends MeasurementView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View getInputView() {
|
protected View getInputView() {
|
||||||
DatePicker datePicker = new DatePicker(getContext());
|
|
||||||
datePicker.setPadding(0, 15, 0, 0);
|
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTime(date);
|
cal.setTime(date);
|
||||||
datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
|
|
||||||
|
DatePickerDialog datePickerDialog = new DatePickerDialog(
|
||||||
|
getContext(),
|
||||||
|
null,
|
||||||
|
cal.get(Calendar.YEAR),
|
||||||
|
cal.get(Calendar.MONTH),
|
||||||
cal.get(Calendar.DAY_OF_MONTH));
|
cal.get(Calendar.DAY_OF_MONTH));
|
||||||
|
|
||||||
return datePicker;
|
return datePickerDialog.getDatePicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -4,8 +4,14 @@
|
|||||||
<item name="colorPrimary">@color/primaryColor</item>
|
<item name="colorPrimary">@color/primaryColor</item>
|
||||||
<item name="colorPrimaryDark">@color/primaryDarkColor</item>
|
<item name="colorPrimaryDark">@color/primaryDarkColor</item>
|
||||||
<item name="colorAccent">@color/primaryLightColor</item>
|
<item name="colorAccent">@color/primaryLightColor</item>
|
||||||
|
<item name="android:datePickerStyle">@style/DatePickerStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme_Dark" parent="Theme.AppCompat.NoActionBar">
|
<style name="AppTheme_Dark" parent="Theme.AppCompat.NoActionBar">
|
||||||
|
<item name="android:datePickerStyle">@style/DatePickerStyle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DatePickerStyle" parent="@android:style/Widget.Material.Light.DatePicker">
|
||||||
|
<item name="android:datePickerMode">spinner</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user