Skip to content

Commit 9dc9e10

Browse files
authored
Merge pull request #434 from GwtMaterialDesign/release_2.6.0
Release 2.6.0
2 parents f91df01 + 76c8708 commit 9dc9e10

File tree

64 files changed

+44047
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+44047
-138
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ cache:
88
- $HOME/.m2
99
before_install:
1010
# install the gwt-material-jquery library before we build the demo
11-
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
11+
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
1212
- cd gwt-material-jquery
1313
- mvn install -DskipTests=true -DdryRun=true
1414
- cd ..
1515
# install the gwt-material library before we build the demo
16-
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material.git
16+
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material.git
1717
- cd gwt-material
1818
- mvn install -DskipTests=true -DdryRun=true
1919
- cd ..
2020
# install the gwt-material-table library before we build the demo
21-
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material-table.git
21+
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material-table.git
2222
- cd gwt-material-table
2323
- mvn install -DskipTests=true -DdryRun=true
2424
- cd ..

.utility/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.5.0_rc1" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.0" ]; then
44
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
55
mvn deploy -DskipTests --settings ~/settings.xml
66
fi

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66

77
Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gwt-material <br>
88

9-
## Current Version 2.5.0
9+
## Current Version 2.6.0
1010
```xml
1111
<dependency>
1212
<groupId>com.github.gwtmaterialdesign</groupId>
1313
<artifactId>gwt-material-addins</artifactId>
14-
<version>2.5.0</version>
14+
<version>2.6.0</version>
1515
</dependency>
1616
```
1717

18-
## Snapshot Version 2.5.0
18+
## Snapshot Version 2.6.1
1919
```xml
2020
<dependency>
2121
<groupId>com.github.gwtmaterialdesign</groupId>
2222
<artifactId>gwt-material-addins</artifactId>
23-
<version>2.5.0</version>
23+
<version>2.6.1-SNAPSHOT</version>
2424
</dependency>
2525
```
2626

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>gwt-material-parent</artifactId>
77
<groupId>com.github.gwtmaterialdesign</groupId>
8-
<version>2.5.0</version>
8+
<version>2.6.0</version>
99
</parent>
1010

1111
<artifactId>gwt-material-addins</artifactId>
@@ -24,7 +24,7 @@
2424
<connection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</connection>
2525
<developerConnection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
2626
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
27-
<tag>v2.5.0</tag>
27+
<tag>v2.6.0</tag>
2828
</scm>
2929

3030
<licenses>

src/main/java/gwt/material/design/addins/client/banner/MaterialBanner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ public void open(Element... targetElements) {
123123

124124
@Override
125125
public void close() {
126+
int outerHeight = getOuterHeight();
126127
getOpenMixin().setOn(false);
127-
setTop(-getOuterHeight());
128+
setTop(outerHeight > 0 ? -outerHeight : -64);
128129
pushTargetElements(0);
129130
CloseEvent.fire(this, getMessage());
130131
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.addins.client.camera;
21+
22+
public enum CameraResolution {
23+
24+
/**
25+
* Quarter Video Graphics Array
26+
*/
27+
QVGA(320, 240),
28+
/**
29+
* Standard Definition
30+
**/
31+
SD(640, 480),
32+
/**
33+
* High Definition
34+
**/
35+
HD(1280, 720),
36+
/**
37+
* Full High Definition
38+
**/
39+
FULL_HD(1920, 1080),
40+
/**
41+
* Television 4K
42+
**/
43+
TELEVISION_4K(3840, 2160),
44+
/**
45+
* Cinema 4K
46+
**/
47+
CINEMA_4K(4096, 2160),
48+
/**
49+
* 8K
50+
**/
51+
_8K(7680, 4320);
52+
53+
private int width;
54+
private int height;
55+
56+
CameraResolution(int width, int height) {
57+
this.width = width;
58+
this.height = height;
59+
}
60+
61+
public int getWidth() {
62+
return width;
63+
}
64+
65+
public int getHeight() {
66+
return height;
67+
}
68+
69+
public static CameraResolution get(String name) {
70+
for (CameraResolution value : values()) {
71+
if (name.toUpperCase().equals(value.name())) {
72+
return value;
73+
}
74+
}
75+
return HD;
76+
}
77+
}

src/main/java/gwt/material/design/addins/client/camera/MaterialCameraCapture.java

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
import com.google.gwt.core.client.GWT;
2626
import com.google.gwt.dom.client.*;
2727
import com.google.gwt.event.shared.HandlerRegistration;
28-
import gwt.material.design.addins.client.camera.base.HasCameraActions;
29-
import gwt.material.design.addins.client.camera.base.HasCameraCaptureHandlers;
28+
import gwt.material.design.addins.client.camera.base.*;
3029
import gwt.material.design.addins.client.camera.constants.CameraFacingMode;
3130
import gwt.material.design.addins.client.camera.events.CameraCaptureEvent;
3231
import gwt.material.design.addins.client.camera.events.CameraCaptureEvent.CaptureStatus;
@@ -37,6 +36,9 @@
3736
import gwt.material.design.jscore.client.api.Navigator;
3837
import gwt.material.design.jscore.client.api.media.*;
3938

39+
import java.util.ArrayList;
40+
import java.util.List;
41+
4042
import static gwt.material.design.addins.client.camera.JsCamera.$;
4143

4244

@@ -108,6 +110,7 @@ public class MaterialCameraCapture extends MaterialWidget implements JsLoader, H
108110
private MediaStream mediaStream;
109111
private MaterialWidget video = new MaterialWidget(Document.get().createVideoElement());
110112
private MaterialPanel overlayPanel;
113+
private boolean autoPlay = true;
111114

112115
public MaterialCameraCapture() {
113116
super(Document.get().createDivElement(), "camera-wrapper");
@@ -125,7 +128,7 @@ protected void onLoad() {
125128

126129
@Override
127130
public void load() {
128-
play();
131+
if (autoPlay) play();
129132
}
130133

131134
@Override
@@ -327,6 +330,14 @@ public MaterialPanel getOverlayPanel() {
327330
return overlayPanel;
328331
}
329332

333+
public boolean isAutoPlay() {
334+
return autoPlay;
335+
}
336+
337+
public void setAutoPlay(boolean autoPlay) {
338+
this.autoPlay = autoPlay;
339+
}
340+
330341
/**
331342
* Set the resolution of the camera
332343
*/
@@ -336,6 +347,15 @@ public void setResolution(int width, int height) {
336347
reload();
337348
}
338349

350+
/**
351+
* Set the resolution the camera
352+
*
353+
* @see CameraResolution
354+
*/
355+
public void setResolution(CameraResolution resolution) {
356+
setResolution(resolution.getWidth(), resolution.getHeight());
357+
}
358+
339359
/**
340360
* Set the facing mode of the camera (Best usecase for Mobile Devices)
341361
*/
@@ -373,4 +393,51 @@ public HandlerRegistration addCameraCaptureHandler(final CameraCaptureHandler ha
373393
}
374394
}, CameraCaptureEvent.getType());
375395
}
396+
397+
public static void isSupported(CameraSupportCallback callback) {
398+
if (isSupported()) {
399+
checkRegisteredCamera(devices -> {
400+
if (devices.size() > 0) {
401+
checkAllowedCamera(callback::call);
402+
} else {
403+
callback.call(false);
404+
}
405+
});
406+
} else {
407+
callback.call(false);
408+
}
409+
}
410+
411+
public static void checkRegisteredCamera(RegisteredCameraCallback callback) {
412+
Navigator.mediaDevices.enumerateDevices().then(param1 -> {
413+
List<MediaDeviceInfo> cameraDevices = new ArrayList<>();
414+
Object[] objects = (Object[]) param1;
415+
if (objects != null) {
416+
for (Object object : objects) {
417+
if (object instanceof MediaDeviceInfo) {
418+
if (((MediaDeviceInfo) object).kind.equals("videoinput")) {
419+
cameraDevices.add((MediaDeviceInfo) object);
420+
}
421+
}
422+
}
423+
}
424+
callback.call(cameraDevices);
425+
return true;
426+
}).fail((e, param1) -> {
427+
callback.call(new ArrayList<>());
428+
return false;
429+
});
430+
}
431+
432+
public static void checkAllowedCamera(AllowedCameraCallback callback) {
433+
Constraints constraints = new Constraints();
434+
constraints.video = true;
435+
Navigator.mediaDevices.getUserMedia(constraints).then(param11 -> {
436+
callback.call(true);
437+
return true;
438+
}).fail((e, param11) -> {
439+
callback.call(false);
440+
return false;
441+
});
442+
}
376443
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.addins.client.camera.base;
21+
22+
public interface AllowedCameraCallback {
23+
24+
void call(boolean allowed);
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.addins.client.camera.base;
21+
22+
public interface CameraSupportCallback {
23+
24+
void call(boolean supported);
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.addins.client.camera.base;
21+
22+
import gwt.material.design.jscore.client.api.media.MediaDeviceInfo;
23+
24+
import java.util.List;
25+
26+
public interface RegisteredCameraCallback {
27+
28+
void call(List<MediaDeviceInfo> devices);
29+
}

0 commit comments

Comments
 (0)