mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025149: Samples - add Qt5/QML sample for Android 4.x
This commit is contained in:
82
samples/qt/AndroidQt/android/AndroidManifest.xml
Normal file
82
samples/qt/AndroidQt/android/AndroidManifest.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0"?>
|
||||
<manifest package="org.qtproject.example.AndroidQt" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="0" android:versionName="">
|
||||
<application android:hardwareAccelerated="true"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtApplication"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.example.AndroidQt.AndroidQt"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape"
|
||||
android:launchMode="singleInstance">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<!-- For file browsers -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<data android:scheme=""/>
|
||||
<data android:scheme="file"/>
|
||||
<data android:host="*"/>
|
||||
|
||||
<data android:pathPattern=".*\\.brep"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- For email attachments -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:mimeType="application/octet-stream" host="*" android:scheme="content"/>
|
||||
|
||||
|
||||
<data android:pathPattern=".*\\.brep"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="AndroidQt"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so:lib/libQt5QuickParticles.so"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroidAccessibility.jar:jar/QtAndroid-bundled.jar:jar/QtAndroidAccessibility-bundled.jar"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value=""/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!--
|
||||
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
|
||||
-->
|
||||
<!-- Splash screen -->
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default features. -->
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||
|
||||
</manifest>
|
1
samples/qt/AndroidQt/android/assets/opencascade/shared/.gitignore
vendored
Normal file
1
samples/qt/AndroidQt/android/assets/opencascade/shared/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Shaders
|
BIN
samples/qt/AndroidQt/android/res/drawable-hdpi/ic_launcher.png
Normal file
BIN
samples/qt/AndroidQt/android/res/drawable-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
samples/qt/AndroidQt/android/res/drawable-mdpi/ic_launcher.png
Normal file
BIN
samples/qt/AndroidQt/android/res/drawable-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
samples/qt/AndroidQt/android/res/drawable-xhdpi/ic_launcher.png
Normal file
BIN
samples/qt/AndroidQt/android/res/drawable-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
samples/qt/AndroidQt/android/res/drawable-xxhdpi/ic_launcher.png
Normal file
BIN
samples/qt/AndroidQt/android/res/drawable-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
4
samples/qt/AndroidQt/android/res/values/strings.xml
Normal file
4
samples/qt/AndroidQt/android/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name">AndroidQt</string>
|
||||
</resources>
|
@@ -0,0 +1,99 @@
|
||||
package org.qtproject.example.AndroidQt;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class AndroidQt extends org.qtproject.qt5.android.bindings.QtActivity
|
||||
{
|
||||
@Override public void onCreate(Bundle theBundle)
|
||||
{
|
||||
super.onCreate(theBundle);
|
||||
|
||||
// copy OCCT resources
|
||||
String aResFolder = getFilesDir().getAbsolutePath();
|
||||
copyAssetFolder (getAssets(), "opencascade", aResFolder + "/opencascade");
|
||||
|
||||
}
|
||||
|
||||
//! Copy folder from assets
|
||||
private boolean copyAssetFolder (AssetManager theAssetMgr,
|
||||
String theAssetFolder,
|
||||
String theFolderPathTo)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] aFiles = theAssetMgr.list (theAssetFolder);
|
||||
File aFolder = new File (theFolderPathTo);
|
||||
aFolder.mkdirs();
|
||||
boolean isOk = true;
|
||||
for (String aFileIter : aFiles)
|
||||
{
|
||||
if (aFileIter.contains ("."))
|
||||
{
|
||||
isOk &= copyAsset (theAssetMgr,
|
||||
theAssetFolder + "/" + aFileIter,
|
||||
theFolderPathTo + "/" + aFileIter);
|
||||
}
|
||||
else
|
||||
{
|
||||
isOk &= copyAssetFolder (theAssetMgr,
|
||||
theAssetFolder + "/" + aFileIter,
|
||||
theFolderPathTo + "/" + aFileIter);
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
catch (Exception theError)
|
||||
{
|
||||
theError.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//! Copy single file from assets
|
||||
private boolean copyAsset (AssetManager theAssetMgr,
|
||||
String thePathFrom,
|
||||
String thePathTo)
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream aStreamIn = theAssetMgr.open (thePathFrom);
|
||||
File aFileTo = new File (thePathTo);
|
||||
aFileTo.createNewFile();
|
||||
OutputStream aStreamOut = new FileOutputStream (thePathTo);
|
||||
copyStreamContent (aStreamIn, aStreamOut);
|
||||
aStreamIn.close();
|
||||
aStreamIn = null;
|
||||
aStreamOut.flush();
|
||||
aStreamOut.close();
|
||||
aStreamOut = null;
|
||||
return true;
|
||||
}
|
||||
catch (Exception theError)
|
||||
{
|
||||
theError.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//! Copy single file
|
||||
private static void copyStreamContent (InputStream theIn,
|
||||
OutputStream theOut) throws IOException
|
||||
{
|
||||
byte[] aBuffer = new byte[1024];
|
||||
int aNbReadBytes = 0;
|
||||
while ((aNbReadBytes = theIn.read (aBuffer)) != -1)
|
||||
{
|
||||
theOut.write (aBuffer, 0, aNbReadBytes);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user