Skip to content

Commit

Permalink
未来时间选择优化
Browse files Browse the repository at this point in the history
  • Loading branch information
yijiebuyi committed Apr 12, 2018
1 parent 91fb2ef commit e142043
Show file tree
Hide file tree
Showing 40 changed files with 636 additions and 263 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

compile project(':libragy')
compile project(':library')
}
27 changes: 21 additions & 6 deletions app/src/main/java/com/wp/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.widget.Toast;

import com.wheelpicker.DataPicker;
import com.wheelpicker.DateWheelPicker;

import java.util.ArrayList;
import java.util.Date;
Expand Down Expand Up @@ -33,15 +34,29 @@ public void onBirthPicked(int year, int month, int day) {
}
});

findViewById(R.id.picker_future_date).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DataPicker.pickFutureDate(MainActivity.this, new Date(System.currentTimeMillis()),
DateWheelPicker.TYPE_ALL, View.VISIBLE, new DataPicker.OnDatePickListener() {
@Override
public void onDatePicked(int year, int month, int day, int hour, int minute, int second) {
Toast.makeText(MainActivity.this, year + "-" + (month + 1) + "-" + day + " " + hour + ":" + minute, Toast.LENGTH_SHORT).show();
}
});
}
});

findViewById(R.id.picker_future).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DataPicker.pickFutureDate(MainActivity.this, new Date(System.currentTimeMillis() + 30 * 60 * 1000), new DataPicker.OnDatePickListener() {
@Override
public void onDatePicked(int year, int month, int day, int hour, int minute, int second) {
Toast.makeText(MainActivity.this, year + "-" + (month + 1) + "-" + day + " " + hour + ":" + minute, Toast.LENGTH_SHORT).show();
}
});
DataPicker.pickFutureDate(MainActivity.this, new Date(System.currentTimeMillis() + 30 * 60 * 1000),
365, new DataPicker.OnDatePickListener() {
@Override
public void onDatePicked(int year, int month, int day, int hour, int minute, int second) {
Toast.makeText(MainActivity.this, year + "-" + (month + 1) + "-" + day + " " + hour + ":" + minute, Toast.LENGTH_SHORT).show();
}
});
}
});

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
android:layout_marginTop="10dp"
android:text="选择生日日期"/>

<Button android:id="@+id/picker_future_date"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:text="选择未来日期"/>

<Button android:id="@+id/picker_future"
android:layout_width="150dp"
android:layout_height="50dp"
Expand Down
198 changes: 0 additions & 198 deletions libragy/src/main/java/com/wheelpicker/DataPicker.java

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e142043

Please sign in to comment.