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

Adding a TimePicker-Spinner #509

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

buildTypes {
Expand Down

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions library/src/main/res/drawable/ic_clock.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ffffff"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>
9 changes: 9 additions & 0 deletions library/src/main/res/drawable/ic_spinner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ffffff"
android:pathData="M20,5L4,5c-1.1,0 -1.99,0.9 -1.99,2L2,17c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,7c0,-1.1 -0.9,-2 -2,-2zM11,8h2v2h-2L11,8zM11,11h2v2h-2v-2zM8,8h2v2L8,10L8,8zM8,11h2v2L8,13v-2zM7,13L5,13v-2h2v2zM7,10L5,10L5,8h2v2zM16,17L8,17v-2h8v2zM16,13h-2v-2h2v2zM16,10h-2L14,8h2v2zM19,13h-2v-2h2v2zM19,10h-2L17,8h2v2z"/>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Wouter Dullaert
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mdtp_time_picker_dialog"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:background="@color/mdtp_background_color"
android:focusable="true">
<include layout="@layout/mdtp_time_title_view_v2" />
<FrameLayout
android:id="@+id/mdtp_time_display_background"
android:layout_width="@dimen/mdtp_date_picker_header_width"
android:layout_height="match_parent"
android:background="@color/mdtp_accent_color" >

<include
layout="@layout/mdtp_time_header_label"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />

<ImageView
android:id="@+id/iv_change_mode"
android:contentDescription="@string/change_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="15dp"
android:padding="@dimen/mdtp_change_mode_icon"
app:srcCompat="@drawable/ic_spinner" />

</FrameLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">

<TimePicker
android:id="@+id/mdtp_time_spinner"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:addStatesFromChildren="true"
android:background="@color/mdtp_circle_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:timePickerMode="spinner"
android:visibility="gone" />

<com.wdullaer.materialdatetimepicker.time.RadialPickerLayout
android:id="@+id/mdtp_time_picker"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@color/mdtp_circle_background" />
<include
layout="@layout/mdtp_done_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-16dp"/>
</LinearLayout>
</LinearLayout>
57 changes: 57 additions & 0 deletions library/src/main/res/layout-land/mdtp_time_spinner_dialog_v2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Wouter Dullaert
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mdtp_time_picker_dialog"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:background="@color/mdtp_background_color"
android:focusable="true" >
<include layout="@layout/mdtp_time_title_view_v2" />
<FrameLayout
android:id="@+id/mdtp_time_display_background"
android:layout_width="@dimen/mdtp_date_picker_header_width"
android:layout_height="match_parent"
android:background="@color/mdtp_accent_color" >
<include
layout="@layout/mdtp_time_header_label"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</FrameLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<TimePicker
android:id="@+id/mdtp_time_spinner"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:addStatesFromChildren="true"
android:background="@color/mdtp_circle_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:timePickerMode="spinner"/>
<include
layout="@layout/mdtp_done_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-16dp"/>
</LinearLayout>
</LinearLayout>
74 changes: 74 additions & 0 deletions library/src/main/res/layout/mdtp_time_picker_spinner_dialog_v2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Wouter Dullaert
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mdtp_time_picker_dialog"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:background="@color/mdtp_background_color"
android:focusable="true">
<LinearLayout
android:id="@+id/mdtp_time_display_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/mdtp_accent_color" >

<include layout="@layout/mdtp_time_title_view_v2" />

<include
layout="@layout/mdtp_time_header_label"
android:layout_width="match_parent"
android:layout_height="@dimen/mdtp_header_height"
android:layout_gravity="center" />

<ImageView
android:id="@+id/iv_change_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/mdtp_change_mode_icon"
android:contentDescription="@string/change_mode"
app:srcCompat="@drawable/ic_spinner" />

<TimePicker
android:id="@+id/mdtp_time_spinner"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:addStatesFromChildren="true"
android:background="@color/mdtp_circle_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:timePickerMode="spinner"
android:visibility="gone" />

<com.wdullaer.materialdatetimepicker.time.RadialPickerLayout
android:id="@+id/mdtp_time_picker"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:background="@color/mdtp_circle_background"
android:focusable="true"
android:focusableInTouchMode="true">

</com.wdullaer.materialdatetimepicker.time.RadialPickerLayout>
</LinearLayout>

<include layout="@layout/mdtp_done_button" />
</LinearLayout>
54 changes: 54 additions & 0 deletions library/src/main/res/layout/mdtp_time_spinner_dialog_v2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Wouter Dullaert
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mdtp_time_picker_dialog"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:background="@color/mdtp_background_color"
android:focusable="true">
<LinearLayout
android:id="@+id/mdtp_time_display_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/mdtp_accent_color" >

<include layout="@layout/mdtp_time_title_view_v2" />

<include
layout="@layout/mdtp_time_header_label"
android:layout_width="match_parent"
android:layout_height="@dimen/mdtp_header_height"
android:layout_gravity="center" />

<TimePicker
android:id="@+id/mdtp_time_spinner"
android:layout_width="@dimen/mdtp_picker_dimen"
android:layout_height="@dimen/mdtp_picker_dimen"
android:layout_gravity="center"
android:addStatesFromChildren="true"
android:background="@color/mdtp_circle_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:timePickerMode="spinner" />
</LinearLayout>

<include layout="@layout/mdtp_done_button" />
</LinearLayout>
1 change: 1 addition & 0 deletions library/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@
<color name="mdtp_done_text_color_dark_normal">#ffffff</color>
<color name="mdtp_done_text_color_dark_disabled">#888888</color>
<color name="mdtp_done_disabled_dark">#bfbfbf</color>

</resources>
2 changes: 2 additions & 0 deletions library/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@
<dimen name="mdtp_material_button_textsize">14sp</dimen>
<dimen name="mdtp_material_button_minwidth">64dp</dimen>
<dimen name="mdtp_material_button_textpadding_horizontal">8dp</dimen>

<dimen name="mdtp_change_mode_icon">5dp</dimen>
</resources>
1 change: 1 addition & 0 deletions library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,5 @@

<string name="mdtp_am">am</string>
<string name="mdtp_pm">pm</string>
<string name="change_mode">Change the TimePicker mode</string>
</resources>
Loading