Added android manifest and launcher icons.
Do not use pkg-config when cross-compiling to Android. Added a helper class to send toasts and dialogs to the user. Added android compatibility on some headers.
This commit is contained in:
40
android/AndroidManifest.xml
Normal file
40
android/AndroidManifest.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.2.5" android:installLocation="auto" package="com.github.codestation.qcma" android:versionCode="1">
|
||||||
|
<application android:label="qcma" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/icon">
|
||||||
|
<activity android:screenOrientation="unspecified" android:label="@string/app_name" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:value="qcma" android:name="android.app.lib_name"/>
|
||||||
|
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||||
|
<meta-data android:value="default" android:name="android.app.repository"/>
|
||||||
|
<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:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --" android:name="android.app.bundle_local_qt_libs"/>
|
||||||
|
<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:value="-- %%USE_LOCAL_QT_LIBS%% --" android:name="android.app.use_local_qt_libs"/>
|
||||||
|
<meta-data android:value="/data/local/tmp/qt/" android:name="android.app.libs_prefix"/>
|
||||||
|
<meta-data android:value="-- %%INSERT_LOCAL_LIBS%% --" android:name="android.app.load_local_libs"/>
|
||||||
|
<meta-data android:value="-- %%INSERT_LOCAL_JARS%% --" android:name="android.app.load_local_jars"/>
|
||||||
|
<meta-data android:value="-- %%INSERT_INIT_CLASSES%% --" android:name="android.app.static_init_classes"/>
|
||||||
|
<!-- 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" android:resource="@layout/splash"/>
|
||||||
|
<!-- Splash screen -->
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="10"/>
|
||||||
|
<supports-screens android:normalScreens="true" android:smallScreens="true" android:largeScreens="true" android:anyDensity="true"/>
|
||||||
|
<!-- %%INSERT_PERMISSIONS -->
|
||||||
|
<!-- %%INSERT_FEATURES -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
</manifest>
|
BIN
android/res/drawable-hdpi/icon.png
Normal file
BIN
android/res/drawable-hdpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
android/res/drawable-ldpi/icon.png
Normal file
BIN
android/res/drawable-ldpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 555 B |
BIN
android/res/drawable-mdpi/icon.png
Normal file
BIN
android/res/drawable-mdpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 755 B |
BIN
android/res/drawable-xhdpi/icon.png
Normal file
BIN
android/res/drawable-xhdpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-xxhdpi/icon.png
Normal file
BIN
android/res/drawable-xxhdpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
package com.github.codestation.qcma;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
|
||||||
|
public class QcmaNotification extends org.qtproject.qt5.android.bindings.QtActivity
|
||||||
|
{
|
||||||
|
private static QcmaNotification m_instance;
|
||||||
|
|
||||||
|
public QcmaNotification()
|
||||||
|
{
|
||||||
|
m_instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showToast(String message)
|
||||||
|
{
|
||||||
|
Context context = m_instance.getApplicationContext();
|
||||||
|
Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDialog(String message)
|
||||||
|
{
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(m_instance);
|
||||||
|
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setMessage(message).setTitle("QCMA message");
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
}
|
||||||
|
}
|
45
src/androidmessage.cpp
Normal file
45
src/androidmessage.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* QCMA: Cross-platform content manager assistant for the PS Vita
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Codestation
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "androidmessage.h"
|
||||||
|
|
||||||
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
|
|
||||||
|
AndroidMessage::AndroidMessage(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidMessage::showToast(const QString &message)
|
||||||
|
{
|
||||||
|
QAndroidJniObject javaMessage = QAndroidJniObject::fromString(message);
|
||||||
|
QAndroidJniObject::callStaticMethod<void>("com/github/codestation/qcma/QcmaNotification",
|
||||||
|
"showToast",
|
||||||
|
"(Ljava/lang/String;)V",
|
||||||
|
javaMessage.object<jstring>());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidMessage::showDialog(const QString &message)
|
||||||
|
{
|
||||||
|
QAndroidJniObject javaMessage = QAndroidJniObject::fromString(message);
|
||||||
|
QAndroidJniObject::callStaticMethod<void>("com/github/codestation/qcma/QcmaNotification",
|
||||||
|
"showDialog",
|
||||||
|
"(Ljava/lang/String;)V",
|
||||||
|
javaMessage.object<jstring>());
|
||||||
|
}
|
36
src/androidmessage.h
Normal file
36
src/androidmessage.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* QCMA: Cross-platform content manager assistant for the PS Vita
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Codestation
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROIDMESSAGE_H
|
||||||
|
#define ANDROIDMESSAGE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class AndroidMessage : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AndroidMessage(QObject *parent = 0);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showToast(const QString &message);
|
||||||
|
void showDialog(const QString &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ANDROIDMESSAGE_H
|
@@ -28,7 +28,13 @@
|
|||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
#ifndef __ANDROID__
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#else
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
#define statvfs statfs
|
||||||
|
#define fstatvfs fstatfs
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total)
|
bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total)
|
||||||
|
Reference in New Issue
Block a user