From eb1a1ca07d92c523defa73fd04f53c89f0473937 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Dec 2016 17:25:04 +0100 Subject: Make qmake happy with the examples structure and install targets Change-Id: I5616e41e62a787693a7e1efb1be924c38b651cae Reviewed-by: J-P Nurmi --- .../android/catalog/android/AndroidManifest.xml | 61 ------------ .../android/catalog/android/assets/awesome.png | Bin 10864 -> 0 bytes examples/android/catalog/android/build.gradle | 61 ------------ .../gradle/wrapper/gradle-wrapper.properties | 6 -- .../android/catalog/android/res/anim/awesome.xml | 23 ----- .../catalog/android/res/drawable/awesome.png | Bin 10864 -> 0 bytes .../android/catalog/android/res/drawable/logo.png | Bin 4842 -> 0 bytes examples/android/catalog/catalog.pro | 25 ----- examples/android/catalog/catalog.qrc | 11 --- examples/android/catalog/main.cpp | 13 --- examples/android/catalog/qml/AwesomeView.qml | 45 --------- examples/android/catalog/qml/ButtonView.qml | 107 --------------------- examples/android/catalog/qml/InputView.qml | 61 ------------ examples/android/catalog/qml/ModelView.qml | 59 ------------ examples/android/catalog/qml/PickerView.qml | 19 ---- examples/android/catalog/qml/ProgressView.qml | 86 ----------------- examples/android/catalog/qml/main.qml | 78 --------------- examples/examples.pro | 2 +- .../qmlandroid/catalog/android/AndroidManifest.xml | 61 ++++++++++++ .../qmlandroid/catalog/android/assets/awesome.png | Bin 0 -> 10864 bytes examples/qmlandroid/catalog/android/build.gradle | 61 ++++++++++++ .../gradle/wrapper/gradle-wrapper.properties | 6 ++ .../catalog/android/res/anim/awesome.xml | 23 +++++ .../catalog/android/res/drawable/awesome.png | Bin 0 -> 10864 bytes .../catalog/android/res/drawable/logo.png | Bin 0 -> 4842 bytes examples/qmlandroid/catalog/catalog.pro | 28 ++++++ examples/qmlandroid/catalog/catalog.qrc | 11 +++ examples/qmlandroid/catalog/main.cpp | 13 +++ examples/qmlandroid/catalog/qml/AwesomeView.qml | 45 +++++++++ examples/qmlandroid/catalog/qml/ButtonView.qml | 107 +++++++++++++++++++++ examples/qmlandroid/catalog/qml/InputView.qml | 61 ++++++++++++ examples/qmlandroid/catalog/qml/ModelView.qml | 59 ++++++++++++ examples/qmlandroid/catalog/qml/PickerView.qml | 19 ++++ examples/qmlandroid/catalog/qml/ProgressView.qml | 86 +++++++++++++++++ examples/qmlandroid/catalog/qml/main.qml | 78 +++++++++++++++ 35 files changed, 659 insertions(+), 656 deletions(-) delete mode 100644 examples/android/catalog/android/AndroidManifest.xml delete mode 100644 examples/android/catalog/android/assets/awesome.png delete mode 100644 examples/android/catalog/android/build.gradle delete mode 100644 examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties delete mode 100644 examples/android/catalog/android/res/anim/awesome.xml delete mode 100644 examples/android/catalog/android/res/drawable/awesome.png delete mode 100644 examples/android/catalog/android/res/drawable/logo.png delete mode 100644 examples/android/catalog/catalog.pro delete mode 100644 examples/android/catalog/catalog.qrc delete mode 100644 examples/android/catalog/main.cpp delete mode 100644 examples/android/catalog/qml/AwesomeView.qml delete mode 100644 examples/android/catalog/qml/ButtonView.qml delete mode 100644 examples/android/catalog/qml/InputView.qml delete mode 100644 examples/android/catalog/qml/ModelView.qml delete mode 100644 examples/android/catalog/qml/PickerView.qml delete mode 100644 examples/android/catalog/qml/ProgressView.qml delete mode 100644 examples/android/catalog/qml/main.qml create mode 100644 examples/qmlandroid/catalog/android/AndroidManifest.xml create mode 100644 examples/qmlandroid/catalog/android/assets/awesome.png create mode 100644 examples/qmlandroid/catalog/android/build.gradle create mode 100644 examples/qmlandroid/catalog/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 examples/qmlandroid/catalog/android/res/anim/awesome.xml create mode 100644 examples/qmlandroid/catalog/android/res/drawable/awesome.png create mode 100644 examples/qmlandroid/catalog/android/res/drawable/logo.png create mode 100644 examples/qmlandroid/catalog/catalog.pro create mode 100644 examples/qmlandroid/catalog/catalog.qrc create mode 100644 examples/qmlandroid/catalog/main.cpp create mode 100644 examples/qmlandroid/catalog/qml/AwesomeView.qml create mode 100644 examples/qmlandroid/catalog/qml/ButtonView.qml create mode 100644 examples/qmlandroid/catalog/qml/InputView.qml create mode 100644 examples/qmlandroid/catalog/qml/ModelView.qml create mode 100644 examples/qmlandroid/catalog/qml/PickerView.qml create mode 100644 examples/qmlandroid/catalog/qml/ProgressView.qml create mode 100644 examples/qmlandroid/catalog/qml/main.qml diff --git a/examples/android/catalog/android/AndroidManifest.xml b/examples/android/catalog/android/AndroidManifest.xml deleted file mode 100644 index 11d18f7..0000000 --- a/examples/android/catalog/android/AndroidManifest.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/android/catalog/android/assets/awesome.png b/examples/android/catalog/android/assets/awesome.png deleted file mode 100644 index 99a8c13..0000000 Binary files a/examples/android/catalog/android/assets/awesome.png and /dev/null differ diff --git a/examples/android/catalog/android/build.gradle b/examples/android/catalog/android/build.gradle deleted file mode 100644 index 80dcc74..0000000 --- a/examples/android/catalog/android/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -buildscript { - repositories { - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' - } -} - -allprojects { - repositories { - jcenter() - } -} - -apply plugin: 'com.android.application' - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:21.0.+' - compile 'com.android.support:cardview-v7:21.0.+' - compile 'com.android.support:recyclerview-v7:21.0.+' - compile 'com.android.support:support-v4:21.0.+' -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion androidBuildToolsVersion - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - lintOptions { - abortOnError false - } -} diff --git a/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties b/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1f..0000000 --- a/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/examples/android/catalog/android/res/anim/awesome.xml b/examples/android/catalog/android/res/anim/awesome.xml deleted file mode 100644 index ee6d387..0000000 --- a/examples/android/catalog/android/res/anim/awesome.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - diff --git a/examples/android/catalog/android/res/drawable/awesome.png b/examples/android/catalog/android/res/drawable/awesome.png deleted file mode 100644 index 99a8c13..0000000 Binary files a/examples/android/catalog/android/res/drawable/awesome.png and /dev/null differ diff --git a/examples/android/catalog/android/res/drawable/logo.png b/examples/android/catalog/android/res/drawable/logo.png deleted file mode 100644 index f3d4a5e..0000000 Binary files a/examples/android/catalog/android/res/drawable/logo.png and /dev/null differ diff --git a/examples/android/catalog/catalog.pro b/examples/android/catalog/catalog.pro deleted file mode 100644 index 8e49352..0000000 --- a/examples/android/catalog/catalog.pro +++ /dev/null @@ -1,25 +0,0 @@ -TEMPLATE = app -TARGET = catalog -QT += qml qmlandroid - -SOURCES += \ - main.cpp - -RESOURCES += \ - catalog.qrc - -OTHER_FILES += \ - qml/main.qml \ - qml/AwesomeView.qml \ - qml/ButtonView.qml \ - qml/InputView.qml \ - qml/ModelView.qml \ - qml/PickerView.qml \ - qml/ProgressView.qml - -DISTFILES += \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -QMLANDROID_PACKAGES = app support view widget diff --git a/examples/android/catalog/catalog.qrc b/examples/android/catalog/catalog.qrc deleted file mode 100644 index 9521232..0000000 --- a/examples/android/catalog/catalog.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - qml/main.qml - qml/AwesomeView.qml - qml/ButtonView.qml - qml/InputView.qml - qml/ModelView.qml - qml/PickerView.qml - qml/ProgressView.qml - - diff --git a/examples/android/catalog/main.cpp b/examples/android/catalog/main.cpp deleted file mode 100644 index 89e848f..0000000 --- a/examples/android/catalog/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - - qRegisterMetaType(); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); - - return app.exec(); -} diff --git a/examples/android/catalog/qml/AwesomeView.qml b/examples/android/catalog/qml/AwesomeView.qml deleted file mode 100644 index 3d1f707..0000000 --- a/examples/android/catalog/qml/AwesomeView.qml +++ /dev/null @@ -1,45 +0,0 @@ -import android.view 0.21 -import android.widget 0.21 -import android.view.animation 0.21 - -RelativeLayout { - ImageView { - imageResource: 2130837555 // TODO: R.drawable.awesome - RelativeLayout.centerInParent: true - -// animation: Animation { -// id: anim -// resource: 2130968582 // TODO: r.anim.awesome -// } - - animation: AnimationSet { - id: anim - shareInterpolator: false - ScaleAnimation { - duration: 4800 - repeatMode: Animation.REVERSE - repeatCount: Animation.INFINITE - fromXScale: 0.5 - fromYScale: 0.5 - toXScale: 1.0 - toYScale: 1.0 - pivotX: 0.5 // "50%" - pivotY: 0.5 // "50%" - pivotXType: Animation.RELATIVE_TO_SELF - pivotYType: Animation.RELATIVE_TO_SELF - interpolator: AccelerateDecelerateInterpolator { } - } - RotateAnimation { - duration: 3200 - repeatCount: Animation.INFINITE - fromDegrees: 0 - toDegrees: -360 - pivotX: 0.5 // "50%" - pivotY: 0.5 // "50%" - pivotXType: Animation.RELATIVE_TO_SELF - pivotYType: Animation.RELATIVE_TO_SELF - interpolator: LinearInterpolator { } - } - } - } -} diff --git a/examples/android/catalog/qml/ButtonView.qml b/examples/android/catalog/qml/ButtonView.qml deleted file mode 100644 index ce09d1e..0000000 --- a/examples/android/catalog/qml/ButtonView.qml +++ /dev/null @@ -1,107 +0,0 @@ -import android.view 0.21 -import android.widget 0.21 -import android.support.v7.widget 0.21 - -ScrollView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "Button"; textSize: 18 } - Space { LinearLayout.height: 48 } - LinearLayout { - Button { text: "Ok" } - Button { - text: "Cancel" - onClick: toast.show() - Toast { - id: toast - text: "Cancelled" - } - } - Space { - LinearLayout.weight: 1 - LinearLayout.width: Layout.WRAP_CONTENT - } - Button { - text: "Attach" - onClick: menu.show() - PopupMenu { - id: menu - MenuItem { title: "Image" } - MenuItem { title: "Document" } - } - } - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "ToggleButton"; textSize: 18 } - Space { LinearLayout.height: 48 } - LinearLayout { - ToggleButton { checked: true } - ToggleButton { } - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "CheckBox"; textSize: 18 } - Space { LinearLayout.height: 48 } - CheckBox { text: "E-mail"; checked: true } - CheckBox { text: "Calendar" } - CheckBox { text: "Contacts" } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "RadioButton"; textSize: 18 } - Space { LinearLayout.height: 48 } - RadioGroup { - RadioButton { text: "Portrait"; checked: true } - RadioButton { text: "Landscape" } - RadioButton { text: "Automatic" } - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "Switch"; textSize: 18 } - Space { LinearLayout.height: 48 } - Switch { text: "Wifi"; checked: true } - Space { LinearLayout.height: 24 } - Switch { text: "Bluetooth" } - } - } - } -} diff --git a/examples/android/catalog/qml/InputView.qml b/examples/android/catalog/qml/InputView.qml deleted file mode 100644 index aec0bbd..0000000 --- a/examples/android/catalog/qml/InputView.qml +++ /dev/null @@ -1,61 +0,0 @@ -import android.widget 0.21 -import android.support.v7.widget 0.21 - -ScrollView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "EditText (single line)"; textSize: 18 } - Space { LinearLayout.height: 48 } - EditText { - hint: "Username" - singleLine: true - } - Space { LinearLayout.height: 48 } - EditText { - hint: "Password" - singleLine: true - inputType: 1 | 128 // TODO: TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "EditText (multi-line)"; textSize: 18 } - Space { LinearLayout.height: 48 } - EditText { - text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat purus urna, in feugiat diam pulvinar non. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Interdum et malesuada fames ac ante ipsum primis in faucibus." - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "Spinner"; textSize: 18 } - Space { LinearLayout.height: 48 } - Spinner { - adapter: ArrayAdapter { - array: ["Apple", "Banana", "Orange"] - } - } - } - } - } -} diff --git a/examples/android/catalog/qml/ModelView.qml b/examples/android/catalog/qml/ModelView.qml deleted file mode 100644 index ef42437..0000000 --- a/examples/android/catalog/qml/ModelView.qml +++ /dev/null @@ -1,59 +0,0 @@ -import android.view 0.21 -import android.widget 0.21 -import android.graphics 0.21 -import android.graphics.drawable 0.21 -import android.support.v4.widget 0.21 -import android.support.v7.widget 0.21 - -import QtQml 2.1 - -TabHost { - LinearLayout { - orientation: LinearLayout.VERTICAL - TabWidget { } - FrameLayout { - LinearLayout.weight: 1 - LinearLayout.height: Layout.WRAP_CONTENT - SwipeRefreshLayout { - id: layout - TabSpec.label: "ListView" - ListView { - adapter: ArrayAdapter { - array: ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"] - } - } - Timer { - interval: 2000 - running: layout.refreshing - onTriggered: layout.refreshing = false - } - } - RecyclerView { - TabSpec.label: "RecyclerView" - adapter: RecyclerAdapter { - count: 50 - delegate: FrameLayout { - CardView { - RelativeLayout { - padding: 48 - ImageView { - imageResource: 2130837556 // TODO: R.drawable.logo - RelativeLayout.centerVertical: true - RelativeLayout.alignParentLeft: true - } - TextView { - text: position - RelativeLayout.alignParentRight: true - RelativeLayout.alignParentBottom: true - } - } - FrameLayout.margin: 48 - FrameLayout.topMargin: position == 0 ? 48 : 0 - FrameLayout.width: Layout.MATCH_PARENT - } - } - } - } - } - } -} diff --git a/examples/android/catalog/qml/PickerView.qml b/examples/android/catalog/qml/PickerView.qml deleted file mode 100644 index a274cbf..0000000 --- a/examples/android/catalog/qml/PickerView.qml +++ /dev/null @@ -1,19 +0,0 @@ -import android.view 0.21 -import android.widget 0.21 - -TabHost { - LinearLayout { - orientation: LinearLayout.VERTICAL - FrameLayout { - LinearLayout.weight: 1 - LinearLayout.height: Layout.WRAP_CONTENT - DatePicker { - TabSpec.label: "DatePicker" - } - TimePicker { - TabSpec.label: "TimePicker" - } - } - TabWidget { } - } -} diff --git a/examples/android/catalog/qml/ProgressView.qml b/examples/android/catalog/qml/ProgressView.qml deleted file mode 100644 index b073ec5..0000000 --- a/examples/android/catalog/qml/ProgressView.qml +++ /dev/null @@ -1,86 +0,0 @@ -import android.view 0.21 -import android.widget 0.21 -import android.support.v7.widget 0.21 - -ScrollView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "ProgressBar"; textSize: 18 } - Space { LinearLayout.height: 48 } - LinearLayout { - ProgressBar { style: ProgressBar.Large } - Space { LinearLayout.width: 48 } - ProgressBar { style: ProgressBar.Medium } - Space { LinearLayout.width: 48 } - ProgressBar { style: ProgressBar.Small } - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: "ProgressBar (horizontal)"; textSize: 18 } - Space { LinearLayout.height: 48 } - ProgressBar { - indeterminate: true - style: ProgressBar.Horizontal - } - Space { LinearLayout.height: 24 } - ProgressBar { - progress: primaryBar.progress - secondaryProgress: secondaryBar.progress - style: ProgressBar.Horizontal - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: qsTr("SeekBar (%1/%2)").arg(primaryBar.progress).arg(secondaryBar.progress); textSize: 18 } - Space { LinearLayout.height: 48 } - SeekBar { - id: primaryBar - progress: 25 - } - SeekBar { - id: secondaryBar - progress: 75 - } - } - } - - Space { LinearLayout.height: 48 } - - CardView { - LinearLayout { - padding: 48 - orientation: LinearLayout.VERTICAL - - TextView { text: qsTr("RatingBar (%1)").arg(ratingBar.rating); textSize: 18 } - Space { LinearLayout.height: 48 } - RatingBar { - id: ratingBar - rating: 3.5 - LinearLayout.width: Layout.WRAP_CONTENT - } - } - } - } -} diff --git a/examples/android/catalog/qml/main.qml b/examples/android/catalog/qml/main.qml deleted file mode 100644 index 08c1156..0000000 --- a/examples/android/catalog/qml/main.qml +++ /dev/null @@ -1,78 +0,0 @@ -import android 0.21 -import android.app 0.21 -import android.view 0.21 -import android.widget 0.21 -import android.graphics 0.21 -import android.graphics.drawable 0.21 -import android.support.v4.widget 0.21 -import android.support.v7.app 0.21 - -Activity { - id: activity - - window.statusBarColor: Color.name("#455a64") - - actionBar: ActionBar { - title: "QML for Android" - subtitle: adapter.getItem(switcher.displayedChild) - background: ColorDrawable { - color: Color.name("#607d8b") - } - } - - optionsMenu: Menu { - MenuItem { - title: "Search" - showAs: MenuItem.SHOW_AS_ACTION_ALWAYS - visible: switcher.displayedChild == 2 - actionView: SearchView { } - } - MenuItem { - title: "About" - onClick: dialog.show() - } - MenuItem { - title: "Exit" - onClick: Qt.quit() - } - } - - AlertDialog { - id: dialog - title: "About" - message: "QML wrappers for native Android controls." - } - - contentView: DrawerLayout { - id: drawer - - ActionBarDrawerToggle { } - - ViewAnimator { - id: switcher - inAnimation: R.anim.slide_in_left - outAnimation: R.anim.slide_out_right - - ButtonView { } - ProgressView { } - InputView { } - PickerView { } - ModelView { } - AwesomeView { } - } - - ListView { - DrawerLayout.gravity: Gravity.LEFT - backgroundColor: Color.name("#eee") - adapter: ArrayAdapter { - id: adapter - style: R.layout.simple_selectable_list_item - array: ["Buttons", "Progress", "Input", "Pickers", "Views", "100%"] - } - onClick: { - drawer.closeDrawer(Gravity.LEFT) - switcher.displayedChild = position - } - } - } -} diff --git a/examples/examples.pro b/examples/examples.pro index 37eb94e..cfd3c75 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs SUBDIRS += \ - android/catalog + qmlandroid/catalog diff --git a/examples/qmlandroid/catalog/android/AndroidManifest.xml b/examples/qmlandroid/catalog/android/AndroidManifest.xml new file mode 100644 index 0000000..11d18f7 --- /dev/null +++ b/examples/qmlandroid/catalog/android/AndroidManifest.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/qmlandroid/catalog/android/assets/awesome.png b/examples/qmlandroid/catalog/android/assets/awesome.png new file mode 100644 index 0000000..99a8c13 Binary files /dev/null and b/examples/qmlandroid/catalog/android/assets/awesome.png differ diff --git a/examples/qmlandroid/catalog/android/build.gradle b/examples/qmlandroid/catalog/android/build.gradle new file mode 100644 index 0000000..80dcc74 --- /dev/null +++ b/examples/qmlandroid/catalog/android/build.gradle @@ -0,0 +1,61 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.1.0' + } +} + +allprojects { + repositories { + jcenter() + } +} + +apply plugin: 'com.android.application' + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.+' + compile 'com.android.support:cardview-v7:21.0.+' + compile 'com.android.support:recyclerview-v7:21.0.+' + compile 'com.android.support:support-v4:21.0.+' +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qt5AndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion.toInteger() + + buildToolsVersion androidBuildToolsVersion + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qt5AndroidDir + '/res', 'res'] + resources.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + lintOptions { + abortOnError false + } +} diff --git a/examples/qmlandroid/catalog/android/gradle/wrapper/gradle-wrapper.properties b/examples/qmlandroid/catalog/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1e61d1f --- /dev/null +++ b/examples/qmlandroid/catalog/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/examples/qmlandroid/catalog/android/res/anim/awesome.xml b/examples/qmlandroid/catalog/android/res/anim/awesome.xml new file mode 100644 index 0000000..ee6d387 --- /dev/null +++ b/examples/qmlandroid/catalog/android/res/anim/awesome.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/examples/qmlandroid/catalog/android/res/drawable/awesome.png b/examples/qmlandroid/catalog/android/res/drawable/awesome.png new file mode 100644 index 0000000..99a8c13 Binary files /dev/null and b/examples/qmlandroid/catalog/android/res/drawable/awesome.png differ diff --git a/examples/qmlandroid/catalog/android/res/drawable/logo.png b/examples/qmlandroid/catalog/android/res/drawable/logo.png new file mode 100644 index 0000000..f3d4a5e Binary files /dev/null and b/examples/qmlandroid/catalog/android/res/drawable/logo.png differ diff --git a/examples/qmlandroid/catalog/catalog.pro b/examples/qmlandroid/catalog/catalog.pro new file mode 100644 index 0000000..4e133d3 --- /dev/null +++ b/examples/qmlandroid/catalog/catalog.pro @@ -0,0 +1,28 @@ +TEMPLATE = app +TARGET = catalog +QT += qml qmlandroid + +SOURCES += \ + main.cpp + +RESOURCES += \ + catalog.qrc + +OTHER_FILES += \ + qml/main.qml \ + qml/AwesomeView.qml \ + qml/ButtonView.qml \ + qml/InputView.qml \ + qml/ModelView.qml \ + qml/PickerView.qml \ + qml/ProgressView.qml + +DISTFILES += \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android +QMLANDROID_PACKAGES = app support view widget + +target.path = $$[QT_INSTALL_EXAMPLES]/qmlandroid/catalog +INSTALLS += target diff --git a/examples/qmlandroid/catalog/catalog.qrc b/examples/qmlandroid/catalog/catalog.qrc new file mode 100644 index 0000000..9521232 --- /dev/null +++ b/examples/qmlandroid/catalog/catalog.qrc @@ -0,0 +1,11 @@ + + + qml/main.qml + qml/AwesomeView.qml + qml/ButtonView.qml + qml/InputView.qml + qml/ModelView.qml + qml/PickerView.qml + qml/ProgressView.qml + + diff --git a/examples/qmlandroid/catalog/main.cpp b/examples/qmlandroid/catalog/main.cpp new file mode 100644 index 0000000..89e848f --- /dev/null +++ b/examples/qmlandroid/catalog/main.cpp @@ -0,0 +1,13 @@ +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + + qRegisterMetaType(); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + + return app.exec(); +} diff --git a/examples/qmlandroid/catalog/qml/AwesomeView.qml b/examples/qmlandroid/catalog/qml/AwesomeView.qml new file mode 100644 index 0000000..3d1f707 --- /dev/null +++ b/examples/qmlandroid/catalog/qml/AwesomeView.qml @@ -0,0 +1,45 @@ +import android.view 0.21 +import android.widget 0.21 +import android.view.animation 0.21 + +RelativeLayout { + ImageView { + imageResource: 2130837555 // TODO: R.drawable.awesome + RelativeLayout.centerInParent: true + +// animation: Animation { +// id: anim +// resource: 2130968582 // TODO: r.anim.awesome +// } + + animation: AnimationSet { + id: anim + shareInterpolator: false + ScaleAnimation { + duration: 4800 + repeatMode: Animation.REVERSE + repeatCount: Animation.INFINITE + fromXScale: 0.5 + fromYScale: 0.5 + toXScale: 1.0 + toYScale: 1.0 + pivotX: 0.5 // "50%" + pivotY: 0.5 // "50%" + pivotXType: Animation.RELATIVE_TO_SELF + pivotYType: Animation.RELATIVE_TO_SELF + interpolator: AccelerateDecelerateInterpolator { } + } + RotateAnimation { + duration: 3200 + repeatCount: Animation.INFINITE + fromDegrees: 0 + toDegrees: -360 + pivotX: 0.5 // "50%" + pivotY: 0.5 // "50%" + pivotXType: Animation.RELATIVE_TO_SELF + pivotYType: Animation.RELATIVE_TO_SELF + interpolator: LinearInterpolator { } + } + } + } +} diff --git a/examples/qmlandroid/catalog/qml/ButtonView.qml b/examples/qmlandroid/catalog/qml/ButtonView.qml new file mode 100644 index 0000000..ce09d1e --- /dev/null +++ b/examples/qmlandroid/catalog/qml/ButtonView.qml @@ -0,0 +1,107 @@ +import android.view 0.21 +import android.widget 0.21 +import android.support.v7.widget 0.21 + +ScrollView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "Button"; textSize: 18 } + Space { LinearLayout.height: 48 } + LinearLayout { + Button { text: "Ok" } + Button { + text: "Cancel" + onClick: toast.show() + Toast { + id: toast + text: "Cancelled" + } + } + Space { + LinearLayout.weight: 1 + LinearLayout.width: Layout.WRAP_CONTENT + } + Button { + text: "Attach" + onClick: menu.show() + PopupMenu { + id: menu + MenuItem { title: "Image" } + MenuItem { title: "Document" } + } + } + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "ToggleButton"; textSize: 18 } + Space { LinearLayout.height: 48 } + LinearLayout { + ToggleButton { checked: true } + ToggleButton { } + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "CheckBox"; textSize: 18 } + Space { LinearLayout.height: 48 } + CheckBox { text: "E-mail"; checked: true } + CheckBox { text: "Calendar" } + CheckBox { text: "Contacts" } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "RadioButton"; textSize: 18 } + Space { LinearLayout.height: 48 } + RadioGroup { + RadioButton { text: "Portrait"; checked: true } + RadioButton { text: "Landscape" } + RadioButton { text: "Automatic" } + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "Switch"; textSize: 18 } + Space { LinearLayout.height: 48 } + Switch { text: "Wifi"; checked: true } + Space { LinearLayout.height: 24 } + Switch { text: "Bluetooth" } + } + } + } +} diff --git a/examples/qmlandroid/catalog/qml/InputView.qml b/examples/qmlandroid/catalog/qml/InputView.qml new file mode 100644 index 0000000..aec0bbd --- /dev/null +++ b/examples/qmlandroid/catalog/qml/InputView.qml @@ -0,0 +1,61 @@ +import android.widget 0.21 +import android.support.v7.widget 0.21 + +ScrollView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "EditText (single line)"; textSize: 18 } + Space { LinearLayout.height: 48 } + EditText { + hint: "Username" + singleLine: true + } + Space { LinearLayout.height: 48 } + EditText { + hint: "Password" + singleLine: true + inputType: 1 | 128 // TODO: TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "EditText (multi-line)"; textSize: 18 } + Space { LinearLayout.height: 48 } + EditText { + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat purus urna, in feugiat diam pulvinar non. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Interdum et malesuada fames ac ante ipsum primis in faucibus." + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "Spinner"; textSize: 18 } + Space { LinearLayout.height: 48 } + Spinner { + adapter: ArrayAdapter { + array: ["Apple", "Banana", "Orange"] + } + } + } + } + } +} diff --git a/examples/qmlandroid/catalog/qml/ModelView.qml b/examples/qmlandroid/catalog/qml/ModelView.qml new file mode 100644 index 0000000..ef42437 --- /dev/null +++ b/examples/qmlandroid/catalog/qml/ModelView.qml @@ -0,0 +1,59 @@ +import android.view 0.21 +import android.widget 0.21 +import android.graphics 0.21 +import android.graphics.drawable 0.21 +import android.support.v4.widget 0.21 +import android.support.v7.widget 0.21 + +import QtQml 2.1 + +TabHost { + LinearLayout { + orientation: LinearLayout.VERTICAL + TabWidget { } + FrameLayout { + LinearLayout.weight: 1 + LinearLayout.height: Layout.WRAP_CONTENT + SwipeRefreshLayout { + id: layout + TabSpec.label: "ListView" + ListView { + adapter: ArrayAdapter { + array: ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"] + } + } + Timer { + interval: 2000 + running: layout.refreshing + onTriggered: layout.refreshing = false + } + } + RecyclerView { + TabSpec.label: "RecyclerView" + adapter: RecyclerAdapter { + count: 50 + delegate: FrameLayout { + CardView { + RelativeLayout { + padding: 48 + ImageView { + imageResource: 2130837556 // TODO: R.drawable.logo + RelativeLayout.centerVertical: true + RelativeLayout.alignParentLeft: true + } + TextView { + text: position + RelativeLayout.alignParentRight: true + RelativeLayout.alignParentBottom: true + } + } + FrameLayout.margin: 48 + FrameLayout.topMargin: position == 0 ? 48 : 0 + FrameLayout.width: Layout.MATCH_PARENT + } + } + } + } + } + } +} diff --git a/examples/qmlandroid/catalog/qml/PickerView.qml b/examples/qmlandroid/catalog/qml/PickerView.qml new file mode 100644 index 0000000..a274cbf --- /dev/null +++ b/examples/qmlandroid/catalog/qml/PickerView.qml @@ -0,0 +1,19 @@ +import android.view 0.21 +import android.widget 0.21 + +TabHost { + LinearLayout { + orientation: LinearLayout.VERTICAL + FrameLayout { + LinearLayout.weight: 1 + LinearLayout.height: Layout.WRAP_CONTENT + DatePicker { + TabSpec.label: "DatePicker" + } + TimePicker { + TabSpec.label: "TimePicker" + } + } + TabWidget { } + } +} diff --git a/examples/qmlandroid/catalog/qml/ProgressView.qml b/examples/qmlandroid/catalog/qml/ProgressView.qml new file mode 100644 index 0000000..b073ec5 --- /dev/null +++ b/examples/qmlandroid/catalog/qml/ProgressView.qml @@ -0,0 +1,86 @@ +import android.view 0.21 +import android.widget 0.21 +import android.support.v7.widget 0.21 + +ScrollView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "ProgressBar"; textSize: 18 } + Space { LinearLayout.height: 48 } + LinearLayout { + ProgressBar { style: ProgressBar.Large } + Space { LinearLayout.width: 48 } + ProgressBar { style: ProgressBar.Medium } + Space { LinearLayout.width: 48 } + ProgressBar { style: ProgressBar.Small } + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: "ProgressBar (horizontal)"; textSize: 18 } + Space { LinearLayout.height: 48 } + ProgressBar { + indeterminate: true + style: ProgressBar.Horizontal + } + Space { LinearLayout.height: 24 } + ProgressBar { + progress: primaryBar.progress + secondaryProgress: secondaryBar.progress + style: ProgressBar.Horizontal + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: qsTr("SeekBar (%1/%2)").arg(primaryBar.progress).arg(secondaryBar.progress); textSize: 18 } + Space { LinearLayout.height: 48 } + SeekBar { + id: primaryBar + progress: 25 + } + SeekBar { + id: secondaryBar + progress: 75 + } + } + } + + Space { LinearLayout.height: 48 } + + CardView { + LinearLayout { + padding: 48 + orientation: LinearLayout.VERTICAL + + TextView { text: qsTr("RatingBar (%1)").arg(ratingBar.rating); textSize: 18 } + Space { LinearLayout.height: 48 } + RatingBar { + id: ratingBar + rating: 3.5 + LinearLayout.width: Layout.WRAP_CONTENT + } + } + } + } +} diff --git a/examples/qmlandroid/catalog/qml/main.qml b/examples/qmlandroid/catalog/qml/main.qml new file mode 100644 index 0000000..08c1156 --- /dev/null +++ b/examples/qmlandroid/catalog/qml/main.qml @@ -0,0 +1,78 @@ +import android 0.21 +import android.app 0.21 +import android.view 0.21 +import android.widget 0.21 +import android.graphics 0.21 +import android.graphics.drawable 0.21 +import android.support.v4.widget 0.21 +import android.support.v7.app 0.21 + +Activity { + id: activity + + window.statusBarColor: Color.name("#455a64") + + actionBar: ActionBar { + title: "QML for Android" + subtitle: adapter.getItem(switcher.displayedChild) + background: ColorDrawable { + color: Color.name("#607d8b") + } + } + + optionsMenu: Menu { + MenuItem { + title: "Search" + showAs: MenuItem.SHOW_AS_ACTION_ALWAYS + visible: switcher.displayedChild == 2 + actionView: SearchView { } + } + MenuItem { + title: "About" + onClick: dialog.show() + } + MenuItem { + title: "Exit" + onClick: Qt.quit() + } + } + + AlertDialog { + id: dialog + title: "About" + message: "QML wrappers for native Android controls." + } + + contentView: DrawerLayout { + id: drawer + + ActionBarDrawerToggle { } + + ViewAnimator { + id: switcher + inAnimation: R.anim.slide_in_left + outAnimation: R.anim.slide_out_right + + ButtonView { } + ProgressView { } + InputView { } + PickerView { } + ModelView { } + AwesomeView { } + } + + ListView { + DrawerLayout.gravity: Gravity.LEFT + backgroundColor: Color.name("#eee") + adapter: ArrayAdapter { + id: adapter + style: R.layout.simple_selectable_list_item + array: ["Buttons", "Progress", "Input", "Pickers", "Views", "100%"] + } + onClick: { + drawer.closeDrawer(Gravity.LEFT) + switcher.displayedChild = position + } + } + } +} -- cgit v1.2.3