aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Zanoni <rzanoni@igalia.com>2021-06-21 09:38:55 +0200
committerRoger Zanoni <rzanoni@igalia.com>2021-06-21 09:38:55 +0200
commit1f0f06e6d53e367986bc0a890aa269a1b6a2a6d0 (patch)
tree5b82f8a4e01233358fa03bf1af719fc5f7b68801
parent48970567f1943fb70ef1526827c21548d23695e7 (diff)
Bundle background and panel sources in the same widgetsandbox/rzanoni/next
Bug-AGL: SPEC-3965 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Signed-off-by: Roger Zanoni <rzanoni@igalia.com> Change-Id: I718ea850ed978a3ebb716a242cbe4c362e4fc5bb
-rw-r--r--src/bg/images/agl_logo_1080.pngbin0 -> 28957 bytes
-rw-r--r--src/bg/images/agl_logo_720.pngbin0 -> 18340 bytes
-rw-r--r--src/bg/images/horizontal_background.pngbin0 -> 1027813 bytes
-rw-r--r--src/bg/images/horizontal_background_720.pngbin0 -> 557151 bytes
-rw-r--r--src/bg/images/vertical_background.pngbin0 -> 948820 bytes
-rw-r--r--src/bg/images/vertical_background_720.pngbin0 -> 516530 bytes
-rw-r--r--src/bg/index.html9
-rw-r--r--src/bg/index.js19
-rw-r--r--src/bg/styles/app.scss22
-rw-r--r--src/bg/styles/landscape.scss5
-rw-r--r--src/bg/styles/main.scss11
-rw-r--r--src/bg/styles/portrait.scss5
-rw-r--r--src/config.json3
-rw-r--r--src/config.xml8
-rw-r--r--src/index.js1
-rw-r--r--src/js/background.js9
-rw-r--r--webpack.config.js19
17 files changed, 98 insertions, 13 deletions
diff --git a/src/bg/images/agl_logo_1080.png b/src/bg/images/agl_logo_1080.png
new file mode 100644
index 0000000..d559e69
--- /dev/null
+++ b/src/bg/images/agl_logo_1080.png
Binary files differ
diff --git a/src/bg/images/agl_logo_720.png b/src/bg/images/agl_logo_720.png
new file mode 100644
index 0000000..7aa5d07
--- /dev/null
+++ b/src/bg/images/agl_logo_720.png
Binary files differ
diff --git a/src/bg/images/horizontal_background.png b/src/bg/images/horizontal_background.png
new file mode 100644
index 0000000..27a811e
--- /dev/null
+++ b/src/bg/images/horizontal_background.png
Binary files differ
diff --git a/src/bg/images/horizontal_background_720.png b/src/bg/images/horizontal_background_720.png
new file mode 100644
index 0000000..3bef6ce
--- /dev/null
+++ b/src/bg/images/horizontal_background_720.png
Binary files differ
diff --git a/src/bg/images/vertical_background.png b/src/bg/images/vertical_background.png
new file mode 100644
index 0000000..76c7679
--- /dev/null
+++ b/src/bg/images/vertical_background.png
Binary files differ
diff --git a/src/bg/images/vertical_background_720.png b/src/bg/images/vertical_background_720.png
new file mode 100644
index 0000000..f25adbf
--- /dev/null
+++ b/src/bg/images/vertical_background_720.png
Binary files differ
diff --git a/src/bg/index.html b/src/bg/index.html
new file mode 100644
index 0000000..ea1f5c2
--- /dev/null
+++ b/src/bg/index.html
@@ -0,0 +1,9 @@
+<html lang="en">
+ <head>
+ <!-- Required meta tags -->
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/src/bg/index.js b/src/bg/index.js
new file mode 100644
index 0000000..4637197
--- /dev/null
+++ b/src/bg/index.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2019 Igalia, S.L.
+ *
+ * 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.
+ */
+
+/* CSS */
+import './styles/app.scss';
+console.log("Loaded app");
diff --git a/src/bg/styles/app.scss b/src/bg/styles/app.scss
new file mode 100644
index 0000000..f5751d7
--- /dev/null
+++ b/src/bg/styles/app.scss
@@ -0,0 +1,22 @@
+//@import "~bootstrap/scss/bootstrap";
+
+@media (max-device-width: 720px) and (orientation: portrait) {
+ @import "main.scss";
+ @import "portrait.scss";
+}
+
+@media (max-device-width: 1280px) and (orientation: landscape) {
+ @import "main.scss";
+ @import "landscape.scss";
+}
+
+@media (min-device-width: 1080px) and (orientation: portrait) {
+ @import "main.scss";
+ @import "portrait.scss";
+}
+
+@media (min-device-width: 1920px) and (orientation: landscape) {
+ @import "main.scss";
+ @import "landscape.scss";
+}
+
diff --git a/src/bg/styles/landscape.scss b/src/bg/styles/landscape.scss
new file mode 100644
index 0000000..bdfddc5
--- /dev/null
+++ b/src/bg/styles/landscape.scss
@@ -0,0 +1,5 @@
+@media (orientation: landscape) {
+ html {
+ background-image: url('../images/horizontal_background.png');
+ }
+}
diff --git a/src/bg/styles/main.scss b/src/bg/styles/main.scss
new file mode 100644
index 0000000..64b89a2
--- /dev/null
+++ b/src/bg/styles/main.scss
@@ -0,0 +1,11 @@
+::-webkit-scrollbar {
+ display: none;
+}
+
+html {
+ height: 100%;
+ width: 100%;
+ background-size: cover;
+ -webkit-overflow-scrolling: touch;
+ margin: 0;
+}
diff --git a/src/bg/styles/portrait.scss b/src/bg/styles/portrait.scss
new file mode 100644
index 0000000..a7d3522
--- /dev/null
+++ b/src/bg/styles/portrait.scss
@@ -0,0 +1,5 @@
+@media (orientation: portrait) {
+ html {
+ background-image: url('../images/vertical_background.png');
+ }
+}
diff --git a/src/config.json b/src/config.json
index 89eb0c8..ccba148 100644
--- a/src/config.json
+++ b/src/config.json
@@ -17,8 +17,7 @@
"icon": "fas fa-music"
}
],
- "background": "webapps-html5-background",
- "launch": "webapps-html5-launcher",
+ "background": "bg/index.html",
"network": {
"bluetooth": "fab fa-bluetooth-b",
"ethernet": "fas fa-network-wired",
diff --git a/src/config.xml b/src/config.xml
index fd74ca5..1e65b1b 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -6,8 +6,12 @@
<description>HTML5 Homescreen demo</description>
<author>Igalia, S.L.</author>
<license>APL 2.0</license>
- <surface role="panel" panel="left"/>
- <window width="218"/>
+
+ <client-shell>
+ <surface role="background" src="bg/" /> <!-- at least a bg is required -->
+ <surface role="panel" edge="left" width="218" src="/" />
+ </client-shell>
+
<feature name="urn:AGL:widget:required-permission">
<param name="urn:AGL:permission::system:run-by-default" value="required" />
<param name="urn:AGL:permission::public:no-htdocs" value="required" />
diff --git a/src/index.js b/src/index.js
index 8198355..d55346b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -26,6 +26,7 @@ import * as background from './js/background';
window.apps = apps;
window.time = time;
+
api.init();
background.load();
app.init();
diff --git a/src/js/background.js b/src/js/background.js
index 38408ed..7cdaf0b 100644
--- a/src/js/background.js
+++ b/src/js/background.js
@@ -3,9 +3,8 @@ import { homescreen, afmMain } from 'agl-js-api';
var configjson = require('../config.json');
export function load() {
- afmMain.start(configjson.background).then(function(result) {
- console.log("loading background: " + result);
- });
+ //afmMain.start(configjson.background).then(function(result) {
+ // console.log("loading background: " + result);
+ //});
+ console.log("Empty for background");
}
-
-
diff --git a/webpack.config.js b/webpack.config.js
index 55c8d7a..60f9d27 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -10,7 +10,8 @@ const ZipPlugin = require('zip-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
- index: './src/index.js'
+ index: './src/index.js',
+ bg: './src/bg/index.js'
},
output: {
path: __dirname + '/dist',
@@ -21,6 +22,9 @@ module.exports = {
},
optimization: {
minimizer: [new UglifyJsPlugin()],
+ splitChunks: {
+ chunks: 'all',
+ },
},
plugins: [
new CleanWebpackPlugin(['dist']),
@@ -52,10 +56,17 @@ module.exports = {
new HtmlWebpackPlugin({
template: 'src/index.html',
filename: 'index.html',
- inject: 'body'
+ inject: 'body',
+ chunks: ['index', 'vendors~index']
+ }),
+ new HtmlWebpackPlugin({
+ template: 'src/bg/index.html',
+ filename: 'bg/index.html',
+ inject: 'body',
+ chunks: ['bg']
}),
new MiniCSSExtractPlugin({
- filename: 'app.css',
+ filename: '[name].css',
path: __dirname + '/dist'
}),
new ZipPlugin({
@@ -114,4 +125,4 @@ module.exports = {
compress: true,
port: 9000
}
-};  \ No newline at end of file
+};