forked from henninghall/react-native-date-picker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom width and height + Layout improvements (henninghall#82)
* Custom height and width. Layout fixes. Organising example projects * After merge fixes * cleanup * cleanup example * cleanup
- Loading branch information
1 parent
99191b0
commit e215538
Showing
605 changed files
with
8,935 additions
and
6,567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ demo | |
docs | ||
example | ||
example-cocoapods | ||
examples | ||
githubREADME.md | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
android/src/main/java/com/henninghall/date_picker/EmptyWheelUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.henninghall.date_picker; | ||
|
||
import java.util.HashMap; | ||
import cn.carbswang.android.numberpickerview.library.NumberPickerView; | ||
|
||
public class EmptyWheelUpdater { | ||
|
||
private final PickerView pickerView; | ||
private final HashMap<Integer, NumberPickerView> views; | ||
|
||
private int[] ids = { | ||
R.id.empty1, | ||
R.id.empty2, | ||
R.id.empty3 | ||
}; | ||
|
||
EmptyWheelUpdater(PickerView pickerView) { | ||
this.pickerView = pickerView; | ||
this.views = getViews(); | ||
} | ||
|
||
private HashMap<Integer, NumberPickerView> getViews() { | ||
HashMap<Integer, NumberPickerView> views = new HashMap<>(); | ||
for (int id: ids) { | ||
NumberPickerView view = (NumberPickerView) pickerView.findViewById(id); | ||
views.put(id, view); | ||
} | ||
return views; | ||
} | ||
|
||
void update(Mode mode) { | ||
hideAll(); | ||
int numberOfVisibleWheels = pickerView.getVisibleWheels().size(); | ||
int emptyViewsToAdd = numberOfVisibleWheels - 1; | ||
int numberOfPickerWheelsBeforeMode = getNumberOfPickerWheelsBeforeMode(mode); | ||
|
||
for (int i = 0; i < emptyViewsToAdd; i++) { | ||
int index = numberOfPickerWheelsBeforeMode + 1 + i * 2; | ||
pickerView.wheelsWrapper.addView(views.get(ids[i]), index); | ||
} | ||
} | ||
|
||
private int getNumberOfPickerWheelsBeforeMode(Mode mode) { | ||
if(mode == Mode.date) return 1; | ||
if(mode == Mode.datetime) return 4; | ||
if(mode == Mode.time) return 5; | ||
return 0; | ||
} | ||
|
||
private void hideAll() { | ||
for (NumberPickerView view: views.values()) { | ||
pickerView.wheelsWrapper.removeView(view); | ||
} | ||
} | ||
|
||
} |
1,542 changes: 1,542 additions & 0 deletions
1,542
android/src/main/java/com/henninghall/date_picker/NumberPickerView.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 14 additions & 41 deletions
55
android/src/main/java/com/henninghall/date_picker/WheelOrderUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
android/src/main/java/com/henninghall/date_picker/WheelPosition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.henninghall.date_picker; | ||
|
||
public enum WheelPosition { | ||
LEFT, RIGHT, MIDDLE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.