diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index d2afecf..1e72c8d 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/android/res/values-v21/styles.xml b/android/res/values-v21/styles.xml index 8d954fa..2b7811f 100644 --- a/android/res/values-v21/styles.xml +++ b/android/res/values-v21/styles.xml @@ -3,7 +3,7 @@ diff --git a/android/src/org/qtproject/qt5/android/bindings/QtActivity.java b/android/src/org/qtproject/qt5/android/bindings/QtActivity.java index 71067f4..62cc056 100644 --- a/android/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/android/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -95,11 +95,12 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT import android.view.ActionMode.Callback; //@ANDROID-11 +import com.iktwo.musicgear.R; public class QtActivity extends Activity { private final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished - private static final int MINISTRO_API_LEVEL = 4; // Ministro api level (check IMinistro.aidl file) + private static final int MINISTRO_API_LEVEL = 5; // Ministro api level (check IMinistro.aidl file) private static final int NECESSITAS_API_LEVEL = 2; // Necessitas api level used by platform plugin private static final int QT_VERSION = 0x050100; // This app requires at least Qt version 5.1.0 @@ -117,6 +118,7 @@ public class QtActivity extends Activity private static final String MAIN_LIBRARY_KEY = "main.library"; private static final String STATIC_INIT_CLASSES_KEY = "static.init.classes"; private static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level"; + private static final String EXTRACT_STYLE_KEY = "extract.android.style"; /// Ministro server parameter keys private static final String REQUIRED_MODULES_KEY = "required.modules"; @@ -178,6 +180,7 @@ public class QtActivity extends Activity // * unstable - unstable repository, DO NOT use this repository in production, // this repository is used to push Qt snapshots. private String[] m_qtLibs = null; // required qt libs + private int m_displayDensity = -1; public QtActivity() { @@ -185,7 +188,7 @@ public QtActivity() QT_ANDROID_THEMES = new String[] {"Theme_Light"}; QT_ANDROID_DEFAULT_THEME = "Theme_Light"; } - else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) { + else if ((Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) || Build.VERSION.SDK_INT == 21){ QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"}; QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light"; } else { @@ -630,6 +633,15 @@ private void startApp(final boolean firstStart) m_activityInfo.metaData.getString("android.app.static_init_classes").split(":")); } loaderParams.putStringArrayList(NATIVE_LIBRARIES_KEY, libraryList); + + + String themePath = getApplicationInfo().dataDir + "/qt-reserved-files/android-style/"; + String stylePath = themePath + m_displayDensity + "/"; + if (!(new File(stylePath)).exists()) + loaderParams.putString(EXTRACT_STYLE_KEY, stylePath); + ENVIRONMENT_VARIABLES += "\tMINISTRO_ANDROID_STYLE_PATH=" + stylePath + + "\tQT_ANDROID_THEMES_ROOT_PATH=" + themePath; + loaderParams.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES + "\tQML2_IMPORT_PATH=" + pluginsPrefix + "/qml" + "\tQML_IMPORT_PATH=" + pluginsPrefix + "/imports" @@ -835,13 +847,24 @@ public void onCreate(Bundle savedInstanceState) try { m_activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); - setTheme(m_activityInfo.getThemeResource()); + for (Field f : Class.forName("android.R$style").getDeclaredFields()) { + if (f.getInt(null) == m_activityInfo.getThemeResource()) { + QT_ANDROID_THEMES = new String[] {f.getName()}; + QT_ANDROID_DEFAULT_THEME = f.getName(); + } + } } catch (Exception e) { e.printStackTrace(); finish(); return; } + try { + setTheme(R.style.AppTheme); + } catch (Exception e) { + e.printStackTrace(); + } + if (Build.VERSION.SDK_INT > 10) { try { requestWindowFeature(Window.class.getField("FEATURE_ACTION_BAR").getInt(null)); @@ -857,8 +880,10 @@ public void onCreate(Bundle savedInstanceState) return; } + m_displayDensity = getResources().getDisplayMetrics().densityDpi; + ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_DEFAULT_THEME - + "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + getResources().getDisplayMetrics().densityDpi + "\t"; + + "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + m_displayDensity + "\t"; if (null == getLastNonConfigurationInstance()) { // if splash screen is defined, then show it @@ -866,6 +891,13 @@ public void onCreate(Bundle savedInstanceState) getWindow().setBackgroundDrawableResource(m_activityInfo.metaData.getInt("android.app.splash_screen_drawable")); else getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000)); + + if (m_activityInfo.metaData.containsKey("android.app.background_running") + && m_activityInfo.metaData.getBoolean("android.app.background_running")) { + ENVIRONMENT_VARIABLES += "QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED=0\t"; + } else { + ENVIRONMENT_VARIABLES += "QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED=1\t"; + } startApp(true); } } diff --git a/musicgear.pro b/musicgear.pro index 835baea..4444d84 100644 --- a/musicgear.pro +++ b/musicgear.pro @@ -50,3 +50,8 @@ TRANSLATIONS += translations/translation_es.ts lupdate_only{ SOURCES = qml/*.qml } + +DISTFILES += \ + android/res/values-v21/styles.xml \ + android/res/values/screen_data.xml \ + android/src/org/qtproject/qt5/android/bindings/QtActivity.java diff --git a/qml/PlaylistDelegate.qml b/qml/PlaylistDelegate.qml index 02721de..09a82c7 100644 --- a/qml/PlaylistDelegate.qml +++ b/qml/PlaylistDelegate.qml @@ -75,7 +75,7 @@ Item { elide: Text.ElideRight color: Style.TEXT_SECONDARY_COLOR_DARK - text: model.length + text: model.artist + " - " + model.length width: parent.width renderType: Text.NativeRendering } diff --git a/qml/main.qml b/qml/main.qml index 9030e53..693d21d 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -9,15 +9,15 @@ ApplicationWindow { id: applicationWindow property var resolutions: [ - {"height": 480, "width": 320, "name": "HVGA", "ratio": "3:2"}, - {"height": 640, "width": 360, "name": "nHD", "ratio": "16:9"}, - {"height": 640, "width": 480, "name": "VGA", "ratio": "4:3"}, - {"height": 800, "width": 480, "name": "WVGA", "ratio": "5:3"}, - {"height": 800, "width": 600, "name": "SVGA", "ratio": "4:3"}, - {"height": 960, "width": 540, "name": "qHD", "ratio": "16:9"}, - {"height": 1280, "width": 720, "name": "720p", "ratio": "16:9"}, - {"height": 1280, "width": 800, "name": "WXGA", "ratio": "16:10"}, - {"height": 1920, "width": 1080, "name": "1080p", "ratio": "16:9"} + {"height": 480, "width": 320, "name": "HVGA", "ratio": "3:2" }, + {"height": 640, "width": 360, "name": "nHD", "ratio": "16:9" }, + {"height": 640, "width": 480, "name": "VGA", "ratio": "4:3" }, + {"height": 800, "width": 480, "name": "WVGA", "ratio": "5:3" }, + {"height": 800, "width": 600, "name": "SVGA", "ratio": "4:3" }, + {"height": 960, "width": 540, "name": "qHD", "ratio": "16:9" }, + {"height": 1280, "width": 720, "name": "720p", "ratio": "16:9" }, + {"height": 1280, "width": 800, "name": "WXGA", "ratio": "16:10" }, + {"height": 1920, "width": 1080, "name": "1080p", "ratio": "16:9" } ] property int currentResolution: 3 @@ -49,13 +49,30 @@ ApplicationWindow { width: resolutions[currentResolution]["width"] height: resolutions[currentResolution]["height"] - FontLoader { source: "qrc:/fonts/Muli-Italic" } - FontLoader { source: "qrc:/fonts/Muli-Light" } - FontLoader { source: "qrc:/fonts/Muli-Light" } + + + FontLoader { source: "qrc:/fonts/Roboto-Black" } + FontLoader { source: "qrc:/fonts/Roboto-BlackItalic" } + FontLoader { source: "qrc:/fonts/Roboto-Bold" } + FontLoader { source: "qrc:/fonts/Roboto-BoldItalic" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-Bold" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-BoldItalic" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-Italic" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-Light" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-LightItalic" } + FontLoader { source: "qrc:/fonts/RobotoCondensed-Regular" } + FontLoader { source: "qrc:/fonts/Roboto-Italic" } + FontLoader { source: "qrc:/fonts/Roboto-Light" } + FontLoader { source: "qrc:/fonts/Roboto-LightItalic" } + FontLoader { source: "qrc:/fonts/Roboto-Medium" } + FontLoader { source: "qrc:/fonts/Roboto-MediumItalic" } + FontLoader { source: "qrc:/fonts/Roboto-Thin" } + FontLoader { source: "qrc:/fonts/Roboto-ThinItalic" } + FontLoader { id: font - source: "qrc:/fonts/Muli-Regular" + source: "qrc:/fonts/Roboto-Regular" onStatusChanged: { if (status === FontLoader.Ready) Theme.fontFamily = font.name diff --git a/resources.qrc b/resources.qrc index 9b8af72..88cb2b2 100644 --- a/resources.qrc +++ b/resources.qrc @@ -131,9 +131,23 @@ resources/images/drawable-xxxhdpi/add_to_playlist.png - resources/fonts/Muli-Italic.ttf - resources/fonts/Muli-Light.ttf - resources/fonts/Muli-LightItalic.ttf - resources/fonts/Muli-Regular.ttf + resources/fonts/Roboto-Black.ttf + resources/fonts/Roboto-BlackItalic.ttf + resources/fonts/Roboto-Bold.ttf + resources/fonts/Roboto-BoldItalic.ttf + resources/fonts/RobotoCondensed-Bold.ttf + resources/fonts/RobotoCondensed-BoldItalic.ttf + resources/fonts/RobotoCondensed-Italic.ttf + resources/fonts/RobotoCondensed-Light.ttf + resources/fonts/RobotoCondensed-LightItalic.ttf + resources/fonts/RobotoCondensed-Regular.ttf + resources/fonts/Roboto-Italic.ttf + resources/fonts/Roboto-Light.ttf + resources/fonts/Roboto-LightItalic.ttf + resources/fonts/Roboto-Medium.ttf + resources/fonts/Roboto-MediumItalic.ttf + resources/fonts/Roboto-Regular.ttf + resources/fonts/Roboto-Thin.ttf + resources/fonts/Roboto-ThinItalic.ttf diff --git a/resources/fonts/Muli-Italic.ttf b/resources/fonts/Muli-Italic.ttf deleted file mode 100644 index 9d20573..0000000 Binary files a/resources/fonts/Muli-Italic.ttf and /dev/null differ diff --git a/resources/fonts/Muli-Light.ttf b/resources/fonts/Muli-Light.ttf deleted file mode 100644 index 8dfff09..0000000 Binary files a/resources/fonts/Muli-Light.ttf and /dev/null differ diff --git a/resources/fonts/Muli-LightItalic.ttf b/resources/fonts/Muli-LightItalic.ttf deleted file mode 100644 index a75b8fd..0000000 Binary files a/resources/fonts/Muli-LightItalic.ttf and /dev/null differ diff --git a/resources/fonts/Muli-Regular.ttf b/resources/fonts/Muli-Regular.ttf deleted file mode 100644 index cf324e4..0000000 Binary files a/resources/fonts/Muli-Regular.ttf and /dev/null differ diff --git a/resources/fonts/OFL.txt b/resources/fonts/OFL.txt deleted file mode 100644 index 8a81298..0000000 --- a/resources/fonts/OFL.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2011 by vernon adams (vern@newtypography.co.uk), -with Reserved Font Name "Muli". -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/resources/fonts/Roboto-Black.ttf b/resources/fonts/Roboto-Black.ttf new file mode 100644 index 0000000..cb905bc Binary files /dev/null and b/resources/fonts/Roboto-Black.ttf differ diff --git a/resources/fonts/Roboto-BlackItalic.ttf b/resources/fonts/Roboto-BlackItalic.ttf new file mode 100644 index 0000000..3ebdc7d Binary files /dev/null and b/resources/fonts/Roboto-BlackItalic.ttf differ diff --git a/resources/fonts/Roboto-Bold.ttf b/resources/fonts/Roboto-Bold.ttf new file mode 100644 index 0000000..68822ca Binary files /dev/null and b/resources/fonts/Roboto-Bold.ttf differ diff --git a/resources/fonts/Roboto-BoldItalic.ttf b/resources/fonts/Roboto-BoldItalic.ttf new file mode 100644 index 0000000..aebf8eb Binary files /dev/null and b/resources/fonts/Roboto-BoldItalic.ttf differ diff --git a/resources/fonts/Roboto-Italic.ttf b/resources/fonts/Roboto-Italic.ttf new file mode 100644 index 0000000..2041cbc Binary files /dev/null and b/resources/fonts/Roboto-Italic.ttf differ diff --git a/resources/fonts/Roboto-Light.ttf b/resources/fonts/Roboto-Light.ttf new file mode 100644 index 0000000..aa45340 Binary files /dev/null and b/resources/fonts/Roboto-Light.ttf differ diff --git a/resources/fonts/Roboto-LightItalic.ttf b/resources/fonts/Roboto-LightItalic.ttf new file mode 100644 index 0000000..a85444f Binary files /dev/null and b/resources/fonts/Roboto-LightItalic.ttf differ diff --git a/resources/fonts/Roboto-Medium.ttf b/resources/fonts/Roboto-Medium.ttf new file mode 100644 index 0000000..a3c1a1f Binary files /dev/null and b/resources/fonts/Roboto-Medium.ttf differ diff --git a/resources/fonts/Roboto-MediumItalic.ttf b/resources/fonts/Roboto-MediumItalic.ttf new file mode 100644 index 0000000..b828205 Binary files /dev/null and b/resources/fonts/Roboto-MediumItalic.ttf differ diff --git a/resources/fonts/Roboto-Regular.ttf b/resources/fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..0e58508 Binary files /dev/null and b/resources/fonts/Roboto-Regular.ttf differ diff --git a/resources/fonts/Roboto-Thin.ttf b/resources/fonts/Roboto-Thin.ttf new file mode 100644 index 0000000..8779333 Binary files /dev/null and b/resources/fonts/Roboto-Thin.ttf differ diff --git a/resources/fonts/Roboto-ThinItalic.ttf b/resources/fonts/Roboto-ThinItalic.ttf new file mode 100644 index 0000000..b79cb26 Binary files /dev/null and b/resources/fonts/Roboto-ThinItalic.ttf differ diff --git a/resources/fonts/RobotoCondensed-Bold.ttf b/resources/fonts/RobotoCondensed-Bold.ttf new file mode 100644 index 0000000..3e06c7c Binary files /dev/null and b/resources/fonts/RobotoCondensed-Bold.ttf differ diff --git a/resources/fonts/RobotoCondensed-BoldItalic.ttf b/resources/fonts/RobotoCondensed-BoldItalic.ttf new file mode 100644 index 0000000..aaf9fe0 Binary files /dev/null and b/resources/fonts/RobotoCondensed-BoldItalic.ttf differ diff --git a/resources/fonts/RobotoCondensed-Italic.ttf b/resources/fonts/RobotoCondensed-Italic.ttf new file mode 100644 index 0000000..d2b611f Binary files /dev/null and b/resources/fonts/RobotoCondensed-Italic.ttf differ diff --git a/resources/fonts/RobotoCondensed-Light.ttf b/resources/fonts/RobotoCondensed-Light.ttf new file mode 100644 index 0000000..d4eb198 Binary files /dev/null and b/resources/fonts/RobotoCondensed-Light.ttf differ diff --git a/resources/fonts/RobotoCondensed-LightItalic.ttf b/resources/fonts/RobotoCondensed-LightItalic.ttf new file mode 100644 index 0000000..a08f3f4 Binary files /dev/null and b/resources/fonts/RobotoCondensed-LightItalic.ttf differ diff --git a/resources/fonts/RobotoCondensed-Regular.ttf b/resources/fonts/RobotoCondensed-Regular.ttf new file mode 100644 index 0000000..b9fc49c Binary files /dev/null and b/resources/fonts/RobotoCondensed-Regular.ttf differ diff --git a/src/downloader.cpp b/src/downloader.cpp index 071c7aa..2e919f5 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -113,6 +113,12 @@ void Downloader::downloadFinished(QNetworkReply *reply) return; } + if (url.toString() == ("http://www.goear.com/billboard/maintenance")) { + setDownloading(false); + emit searchEnded(); + } + + qDebug() << reply->url().toString() << " was redirected to:" << url.toString(); if (url.isRelative())