Skip to content

Commit

Permalink
Merge pull request #434 from GwtMaterialDesign/release_2.6.0
Browse files Browse the repository at this point in the history
Release 2.6.0
  • Loading branch information
kevzlou7979 authored Jul 23, 2022
2 parents f91df01 + 76c8708 commit 9dc9e10
Show file tree
Hide file tree
Showing 64 changed files with 44,047 additions and 138 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery library before we build the demo
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- cd gwt-material-jquery
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material library before we build the demo
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material.git
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material.git
- cd gwt-material
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material-table library before we build the demo
- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material-table.git
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material-table.git
- cd gwt-material-table
- mvn install -DskipTests=true -DdryRun=true
- cd ..
Expand Down
2 changes: 1 addition & 1 deletion .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.5.0_rc1" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.0" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy -DskipTests --settings ~/settings.xml
fi
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

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

## Current Version 2.5.0
## Current Version 2.6.0
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</dependency>
```

## Snapshot Version 2.5.0
## Snapshot Version 2.6.1
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.5.0</version>
<version>2.6.1-SNAPSHOT</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>

<artifactId>gwt-material-addins</artifactId>
Expand All @@ -24,7 +24,7 @@
<connection>scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git</connection>
<developerConnection>scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
<tag>v2.5.0</tag>
<tag>v2.6.0</tag>
</scm>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ public void open(Element... targetElements) {

@Override
public void close() {
int outerHeight = getOuterHeight();
getOpenMixin().setOn(false);
setTop(-getOuterHeight());
setTop(outerHeight > 0 ? -outerHeight : -64);
pushTargetElements(0);
CloseEvent.fire(this, getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2021 GwtMaterialDesign
* %%
* 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.
* #L%
*/
package gwt.material.design.addins.client.camera;

public enum CameraResolution {

/**
* Quarter Video Graphics Array
*/
QVGA(320, 240),
/**
* Standard Definition
**/
SD(640, 480),
/**
* High Definition
**/
HD(1280, 720),
/**
* Full High Definition
**/
FULL_HD(1920, 1080),
/**
* Television 4K
**/
TELEVISION_4K(3840, 2160),
/**
* Cinema 4K
**/
CINEMA_4K(4096, 2160),
/**
* 8K
**/
_8K(7680, 4320);

private int width;
private int height;

CameraResolution(int width, int height) {
this.width = width;
this.height = height;
}

public int getWidth() {
return width;
}

public int getHeight() {
return height;
}

public static CameraResolution get(String name) {
for (CameraResolution value : values()) {
if (name.toUpperCase().equals(value.name())) {
return value;
}
}
return HD;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.*;
import com.google.gwt.event.shared.HandlerRegistration;
import gwt.material.design.addins.client.camera.base.HasCameraActions;
import gwt.material.design.addins.client.camera.base.HasCameraCaptureHandlers;
import gwt.material.design.addins.client.camera.base.*;
import gwt.material.design.addins.client.camera.constants.CameraFacingMode;
import gwt.material.design.addins.client.camera.events.CameraCaptureEvent;
import gwt.material.design.addins.client.camera.events.CameraCaptureEvent.CaptureStatus;
Expand All @@ -37,6 +36,9 @@
import gwt.material.design.jscore.client.api.Navigator;
import gwt.material.design.jscore.client.api.media.*;

import java.util.ArrayList;
import java.util.List;

import static gwt.material.design.addins.client.camera.JsCamera.$;


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

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

@Override
public void load() {
play();
if (autoPlay) play();
}

@Override
Expand Down Expand Up @@ -327,6 +330,14 @@ public MaterialPanel getOverlayPanel() {
return overlayPanel;
}

public boolean isAutoPlay() {
return autoPlay;
}

public void setAutoPlay(boolean autoPlay) {
this.autoPlay = autoPlay;
}

/**
* Set the resolution of the camera
*/
Expand All @@ -336,6 +347,15 @@ public void setResolution(int width, int height) {
reload();
}

/**
* Set the resolution the camera
*
* @see CameraResolution
*/
public void setResolution(CameraResolution resolution) {
setResolution(resolution.getWidth(), resolution.getHeight());
}

/**
* Set the facing mode of the camera (Best usecase for Mobile Devices)
*/
Expand Down Expand Up @@ -373,4 +393,51 @@ public HandlerRegistration addCameraCaptureHandler(final CameraCaptureHandler ha
}
}, CameraCaptureEvent.getType());
}

public static void isSupported(CameraSupportCallback callback) {
if (isSupported()) {
checkRegisteredCamera(devices -> {
if (devices.size() > 0) {
checkAllowedCamera(callback::call);
} else {
callback.call(false);
}
});
} else {
callback.call(false);
}
}

public static void checkRegisteredCamera(RegisteredCameraCallback callback) {
Navigator.mediaDevices.enumerateDevices().then(param1 -> {
List<MediaDeviceInfo> cameraDevices = new ArrayList<>();
Object[] objects = (Object[]) param1;
if (objects != null) {
for (Object object : objects) {
if (object instanceof MediaDeviceInfo) {
if (((MediaDeviceInfo) object).kind.equals("videoinput")) {
cameraDevices.add((MediaDeviceInfo) object);
}
}
}
}
callback.call(cameraDevices);
return true;
}).fail((e, param1) -> {
callback.call(new ArrayList<>());
return false;
});
}

public static void checkAllowedCamera(AllowedCameraCallback callback) {
Constraints constraints = new Constraints();
constraints.video = true;
Navigator.mediaDevices.getUserMedia(constraints).then(param11 -> {
callback.call(true);
return true;
}).fail((e, param11) -> {
callback.call(false);
return false;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2021 GwtMaterialDesign
* %%
* 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.
* #L%
*/
package gwt.material.design.addins.client.camera.base;

public interface AllowedCameraCallback {

void call(boolean allowed);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2021 GwtMaterialDesign
* %%
* 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.
* #L%
*/
package gwt.material.design.addins.client.camera.base;

public interface CameraSupportCallback {

void call(boolean supported);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2021 GwtMaterialDesign
* %%
* 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.
* #L%
*/
package gwt.material.design.addins.client.camera.base;

import gwt.material.design.jscore.client.api.media.MediaDeviceInfo;

import java.util.List;

public interface RegisteredCameraCallback {

void call(List<MediaDeviceInfo> devices);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import gwt.material.design.client.events.ClosingEvent;
import gwt.material.design.client.events.OpeningEvent;
import gwt.material.design.client.ui.MaterialLabel;
import gwt.material.design.client.ui.MaterialToast;
import gwt.material.design.client.ui.html.Label;
import gwt.material.design.client.ui.html.OptGroup;
import gwt.material.design.client.ui.html.Option;
Expand Down Expand Up @@ -282,6 +281,7 @@ public void reload() {
@Override
public void reset() {
super.reset();
setSelectedIndex(0);
displayArrowForAllowClearOption(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ public void setValue(Double value, boolean fireEvents) {
*/
public void setValue(Double value, boolean fireEvents, boolean autoStart) {
super.setValue(value, fireEvents);
setEndValue(value);

if (value != null) {
setEndValue(value);
}

if (autoStart) {
start();
Expand Down
Loading

0 comments on commit 9dc9e10

Please sign in to comment.