Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

modify HOUR_OF_DAY and TimeZone code #325

Open
wants to merge 7 commits 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
Empty file modified .circleci/config.yml
100644 → 100755
Empty file.
Empty file modified .github/FUNDING.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified app/.gitignore
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions app/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'com.google.android.material:material:1.1.0'
implementation "androidx.appcompat:appcompat:1.5.0"
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation project(':singledateandtimepicker')
Expand Down
Empty file modified app/proguard-rules.pro
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SingleDatePickerMainActivityWithDoublePicker">
<activity android:name=".SingleDatePickerMainActivityWithDoublePicker"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
56 changes: 23 additions & 33 deletions ...lorent37/sample/singledateandtimepicker/SingleDatePickerMainActivityWithDoublePicker.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

import com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker;
import com.github.florent37.singledateandtimepicker.dialog.DoubleDateAndTimePickerDialog;
Expand Down Expand Up @@ -48,6 +47,7 @@ public class SingleDatePickerMainActivityWithDoublePicker extends AppCompatActiv
DoubleDateAndTimePickerDialog.Builder doubleBuilder;

private static String TAG = "SingleDatePickerMainActivityWithDoublePicker";
private long currentTime = 0L;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -74,23 +74,27 @@ protected void onPause() {
}



@OnClick(R.id.singleTimeText)
/* TODO Working on it */
@OnClick(R.id.single_time_dialog_layout)
public void simpleTimeClicked() {

Calendar calendar = Calendar.getInstance();

calendar.set(Calendar.HOUR_OF_DAY, 21);
calendar.set(Calendar.MINUTE, 50);
Date date = new Date();
if (currentTime == 0L) {
currentTime = System.currentTimeMillis();
}
SimpleDateFormat currentDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("simpleTimeClicked() " + currentDateFormat.format(currentTime));
date.setTime(currentTime);

final Date defaultDate = calendar.getTime();
TimeZone timeZone = TimeZone.getTimeZone("US/Arizona");
simpleTimeFormat.setTimeZone(timeZone);

singleBuilder = new SingleDateAndTimePickerDialog.Builder(this)
.setTimeZone(TimeZone.getDefault())
.setTimeZone(timeZone)
.bottomSheet()
.curved()

.defaultDate(defaultDate)
.displayAmPm(true)
.defaultDate(date)

//.titleTextColor(Color.GREEN)
//.backgroundColor(Color.BLACK)
Expand All @@ -115,17 +119,15 @@ public void onClosed(SingleDateAndTimePicker picker) {
})

.title("Simple Time")
.listener(new SingleDateAndTimePickerDialog.Listener() {
@Override
public void onDateSelected(Date date) {
singleTimeText.setText(simpleTimeFormat.format(date));
}
.listener(date1 -> {
currentTime = date1.getTime();
singleTimeText.setText(simpleTimeFormat.format(date1));
});
singleBuilder.display();
}


@OnClick(R.id.singleDateText)
@OnClick(R.id.single_date_dialog_layout)
public void simpleDateClicked() {

final Calendar calendar = Calendar.getInstance();
Expand All @@ -135,15 +137,9 @@ public void simpleDateClicked() {
.setTimeZone(TimeZone.getDefault())
.bottomSheet()
.curved()

//.titleTextColor(Color.GREEN)
//.backgroundColor(Color.BLACK)
//.mainColor(Color.GREEN)

.displayHours(false)
.displayMinutes(false)
.displayDays(true)

.displayListener(new SingleDateAndTimePickerDialog.DisplayListener() {
@Override
public void onDisplayed(SingleDateAndTimePicker picker) {
Expand All @@ -155,18 +151,12 @@ public void onClosed(SingleDateAndTimePicker picker) {
Log.d(TAG, "Dialog closed");
}
})

.title("")
.listener(new SingleDateAndTimePickerDialog.Listener() {
@Override
public void onDateSelected(Date date) {
singleDateText.setText(simpleDateOnlyFormat.format(date));
}
});
.listener(date -> singleDateText.setText(simpleDateOnlyFormat.format(date)));
singleBuilder.display();
}

@OnClick(R.id.singleLayout)
@OnClick(R.id.single_dialog_layout)
public void simpleClicked() {

final Calendar calendar = Calendar.getInstance();
Expand Down Expand Up @@ -225,7 +215,7 @@ public void onDateSelected(Date date) {
singleBuilder.display();
}

@OnClick(R.id.doubleLayout)
@OnClick(R.id.double_dialog_layout)
public void doubleClicked() {

final Date now = new Date();
Expand Down Expand Up @@ -274,7 +264,7 @@ public void onDateSelected(List<Date> dates) {
doubleBuilder.display();
}

@OnClick(R.id.singleDateLocaleLayout)
@OnClick(R.id.single_date_dialog_german_layout)
public void singleDateLocaleClicked() {
singleBuilder = new SingleDateAndTimePickerDialog.Builder(this)
.customLocale(Locale.GERMAN)
Expand Down
Empty file modified app/src/main/res/drawable/ic_event_available_black_24dp.xml
100644 → 100755
Empty file.
Empty file modified app/src/main/res/font/dinot_bold.ttf
100644 → 100755
Empty file.
Empty file modified app/src/main/res/font/dinot_regular.ttf
100644 → 100755
Empty file.
Empty file modified app/src/main/res/layout/single_date_picker_activity_main.xml
100644 → 100755
Empty file.
64 changes: 23 additions & 41 deletions app/src/main/res/layout/single_date_picker_activity_main_double_picker.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,167 +3,149 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:orientation="vertical">

<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:elevation="4dp"
app:title="Picker"
app:titleTextColor="@android:color/white"
/>
app:titleTextColor="@android:color/white" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
>
android:orientation="vertical">

<LinearLayout
android:id="@+id/singleLayout"
android:id="@+id/single_dialog_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/ic_event_available_black_24dp"
/>
app:srcCompat="@drawable/ic_event_available_black_24dp" />

<TextView
android:id="@+id/singleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="15sp"
android:text="Click me to open single dialog"
android:textColor="@color/textColor"
/>
android:textSize="15sp" />

</LinearLayout>

<LinearLayout
android:id="@+id/doubleLayout"
android:id="@+id/double_dialog_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/ic_event_available_black_24dp"
/>
app:srcCompat="@drawable/ic_event_available_black_24dp" />

<TextView
android:id="@+id/doubleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="15sp"
android:text="Click me to open double dialog"
android:textColor="@color/textColor"
/>
android:textSize="15sp" />
</LinearLayout>

<LinearLayout
android:id="@+id/singleTimeLayout"
android:id="@+id/single_time_dialog_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/ic_event_available_black_24dp"
/>
app:srcCompat="@drawable/ic_event_available_black_24dp" />

<TextView
android:id="@+id/singleTimeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="15sp"
android:text="Click me to open single dialog for TIME only"
android:textColor="@color/textColor"
/>
android:textSize="15sp" />

</LinearLayout>


<LinearLayout
android:id="@+id/singleDateLayout"
android:id="@+id/single_date_dialog_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/ic_event_available_black_24dp"
/>
app:srcCompat="@drawable/ic_event_available_black_24dp" />

<TextView
android:id="@+id/singleDateText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="15sp"
android:text="Click me to open single dialog for DATE only"
android:textColor="@color/textColor"
/>
android:textSize="15sp" />

</LinearLayout>

<LinearLayout
android:id="@+id/singleDateLocaleLayout"
android:id="@+id/single_date_dialog_german_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/ic_event_available_black_24dp"
/>
app:srcCompat="@drawable/ic_event_available_black_24dp" />

<TextView
android:id="@+id/singleDateLocaleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="15sp"
android:text="Click me to open single dialog for DATE with German Locale"
android:textColor="@color/textColor"
/>
android:textSize="15sp" />

</LinearLayout>

Expand Down
Empty file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/values-w820dp/dimens.xml
100644 → 100755
Empty file.
Empty file modified app/src/main/res/values/colors.xml
100644 → 100755
Empty file.
Empty file modified app/src/main/res/values/strings.xml
100644 → 100755
Empty file.
Empty file modified app/src/main/res/values/styles.xml
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -23,8 +23,8 @@ allprojects {
}

ext {
sdk = 28
minSdk = 14
sdk = 32
minSdk = 23

github = 'https://github.com/florent37/SingleDateAndTimePicker'

Expand Down
Empty file modified circle.yml
100644 → 100755
Empty file.
Empty file modified gradle.properties
100644 → 100755
Empty file.
Empty file modified gradle/bintray-android-v1.gradle
100644 → 100755
Empty file.
Empty file modified gradle/bintray-java-v1.gradle
100644 → 100755
Empty file.
Empty file modified gradle/install-v1.gradle
100644 → 100755
Empty file.
Empty file modified gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
Empty file modified gradle/wrapper/gradle-wrapper.properties
100644 → 100755
Empty file.
Empty file modified gradlew.bat
100644 → 100755
Empty file.
Empty file modified media/custom_colors.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/double.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/double_small.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/double_small_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/ios_double.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/ios_double_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/ios_simple.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/ios_simple_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/layout.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/layout_small.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/new_video.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/new_video.mp4
100644 → 100755
Empty file.
Empty file modified media/simple.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/simple_small.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/single_small_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/single_tiny_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/years_crop.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified settings.gradle
100644 → 100755
Empty file.
Empty file modified singledateandtimepicker/.gitignore
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions singledateandtimepicker/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ android {
defaultConfig {
minSdkVersion project.minSdk
targetSdkVersion project.sdk
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"
}
lintOptions {
abortOnError false
}
}

dependencies {
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.appcompat:appcompat:1.5.0"
}

ext {
Expand Down
Empty file modified singledateandtimepicker/proguard-rules.pro
100644 → 100755
Empty file.
Empty file modified singledateandtimepicker/src/main/AndroidManifest.xml
100644 → 100755
Empty file.
Loading