Skip to content

Commit 90495ba

Browse files
committed
HeroVideo and Keyboard requirements POC
1 parent fb37e51 commit 90495ba

27 files changed

+2240
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2019 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.incubator.client.hero;
21+
22+
import com.google.gwt.dom.client.Document;
23+
import com.google.gwt.dom.client.SourceElement;
24+
import com.google.gwt.dom.client.VideoElement;
25+
import com.google.gwt.user.client.DOM;
26+
import gwt.material.design.client.MaterialDesignBase;
27+
import gwt.material.design.client.base.JsLoader;
28+
import gwt.material.design.client.base.MaterialWidget;
29+
import gwt.material.design.incubator.client.AddinsIncubator;
30+
import gwt.material.design.incubator.client.base.IncubatorWidget;
31+
import gwt.material.design.incubator.client.infinitescroll.InfiniteScrollPanel;
32+
33+
public class HeroVideo extends MaterialWidget implements JsLoader {
34+
35+
static {
36+
IncubatorWidget.showWarning(InfiniteScrollPanel.class);
37+
if (AddinsIncubator.isDebug()) {
38+
MaterialDesignBase.injectCss(HeroVideoDebugClientBundle.INSTANCE.heroVideoDebugCss());
39+
} else {
40+
MaterialDesignBase.injectCss(HeroVideoClientBundle.INSTANCE.heroVideoCss());
41+
}
42+
}
43+
44+
45+
private boolean loop = true;
46+
private boolean autoplay = true;
47+
private boolean muted = true;
48+
private String type = "video/webm";
49+
private String alt = "Hero Video";
50+
private String src;
51+
52+
public HeroVideo() {
53+
super(Document.get().createVideoElement(), "hero-video");
54+
}
55+
56+
@Override
57+
protected void onLoad() {
58+
super.onLoad();
59+
60+
61+
}
62+
63+
@Override
64+
public void load() {
65+
VideoElement element = getElement().cast();
66+
element.setLoop(loop);
67+
element.setAutoplay(autoplay);
68+
element.setMuted(muted);
69+
70+
SourceElement sourceElement = DOM.createElement("source").cast();
71+
sourceElement.setType(type);
72+
sourceElement.setAttribute("alt", alt);
73+
sourceElement.setSrc(src);
74+
element.appendChild(sourceElement);
75+
}
76+
77+
@Override
78+
public void unload() {
79+
getElement().removeAllChildren();
80+
}
81+
82+
@Override
83+
public void reload() {
84+
unload();
85+
load();
86+
}
87+
88+
public boolean isLoop() {
89+
return loop;
90+
}
91+
92+
public void setLoop(boolean loop) {
93+
this.loop = loop;
94+
}
95+
96+
public boolean isAutoplay() {
97+
return autoplay;
98+
}
99+
100+
public void setAutoplay(boolean autoplay) {
101+
this.autoplay = autoplay;
102+
}
103+
104+
public boolean isMuted() {
105+
return muted;
106+
}
107+
108+
public void setMuted(boolean muted) {
109+
this.muted = muted;
110+
}
111+
112+
public String getType() {
113+
return type;
114+
}
115+
116+
public void setType(String type) {
117+
this.type = type;
118+
}
119+
120+
public String getAlt() {
121+
return alt;
122+
}
123+
124+
public void setAlt(String alt) {
125+
this.alt = alt;
126+
}
127+
128+
public String getSrc() {
129+
return src;
130+
}
131+
132+
public void setSrc(String src) {
133+
this.src = src;
134+
reload();
135+
}
136+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2017 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.incubator.client.hero;
21+
22+
import com.google.gwt.core.client.GWT;
23+
import com.google.gwt.resources.client.ClientBundle;
24+
import com.google.gwt.resources.client.TextResource;
25+
import gwt.material.design.incubator.client.infinitescroll.InfiniteScrollPanel;
26+
27+
//@formatter:off
28+
29+
/**
30+
* Client Bundle for {@link InfiniteScrollPanel}
31+
*
32+
* @author kevzlou7979
33+
*/
34+
public interface HeroVideoClientBundle extends ClientBundle {
35+
HeroVideoClientBundle INSTANCE = GWT.create(HeroVideoClientBundle.class);
36+
37+
@Source("resources/css/hero-video.min.css")
38+
TextResource heroVideoCss();
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2017 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.incubator.client.hero;
21+
22+
import com.google.gwt.core.client.GWT;
23+
import com.google.gwt.resources.client.ClientBundle;
24+
import com.google.gwt.resources.client.TextResource;
25+
import gwt.material.design.incubator.client.infinitescroll.InfiniteScrollPanel;
26+
27+
//@formatter:off
28+
29+
/**
30+
* Debug Client Bundle for {@link InfiniteScrollPanel}
31+
*
32+
* @author kevzlou7979
33+
*/
34+
public interface HeroVideoDebugClientBundle extends ClientBundle {
35+
HeroVideoDebugClientBundle INSTANCE = GWT.create(HeroVideoDebugClientBundle.class);
36+
37+
@Source("resources/css/hero-video.css")
38+
TextResource heroVideoDebugCss();
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package gwt.material.design.incubator.client.keyboard;
2+
3+
import gwt.material.design.incubator.client.keyboard.js.KeyboardLayout;
4+
5+
public class NumericScreenKeyboard extends ScreenKeyboard {
6+
7+
public NumericScreenKeyboard() {
8+
super();
9+
}
10+
11+
@Override
12+
protected void load() {
13+
super.load();
14+
15+
KeyboardLayout layout = new KeyboardLayout();
16+
layout.defaultLayout = new String[]{"1 2 3", "4 5 6", "7 8 9", "{shift} 0 -", "{bksp}"};
17+
layout.shiftLayout = new String[]{"! / #", "$ % ^", "& * (", "{shift} ) +", "{bksp}"};
18+
options.setLayout(layout);
19+
options.setTheme("hg-theme-default hg-layout-numeric numeric-theme");
20+
updateOptions(options);
21+
}
22+
}

0 commit comments

Comments
 (0)