new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
47 changed files with 1424 additions and 825 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5.3" android:versionCode="21" android:installLocation="auto">
|
||||
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5.4" android:versionCode="22" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
|
@ -12,8 +12,15 @@
|
|||
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<application android:hardwareAccelerated="false" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:extractNativeLibs="true" android:icon="@drawable/friendiqa" android:theme="@android:style/Theme.Holo.Light" android:logo="@drawable/friendiqa">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTask" android:taskAffinity="">
|
||||
<application android:hardwareAccelerated="false"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtApplication"
|
||||
android:label="Friendiqa"
|
||||
android:extractNativeLibs="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:icon="@drawable/friendiqa"
|
||||
android:theme="@android:style/Theme.Holo.Light"
|
||||
android:logo="@drawable/friendiqa">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
|
69
source-android/android/build.gradle.backup
Normal file
69
source-android/android/build.gradle.backup
Normal file
|
@ -0,0 +1,69 @@
|
|||
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'])
|
||||
}
|
||||
|
||||
//apply plugin: 'android-library'
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-compat:25.3.1'
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
apply from: "androidnative.gradle"
|
||||
setAndroidNativePath("/../androidnative.pri");
|
|
@ -1,4 +1,7 @@
|
|||
# androidBuildToolsVersion=25.0.3
|
||||
# androidCompileSdkVersion=26
|
||||
buildDir=.build
|
||||
# qt5AndroidDir=/home/pankraz/Qt/5.11.1/android_armv7/src/android/java
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.enforceUniquePackageName=false
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.util.Log;
|
|||
import android.app.Activity;
|
||||
import android.os.*;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.Manifest.permission;
|
||||
|
@ -18,7 +19,7 @@ import androidx.core.content.ContextCompat;
|
|||
*/
|
||||
|
||||
public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.QtActivity {
|
||||
public static final int MY_PERMISSIONS_REQUEST_WRITE_STORAGE = 0x245285a8;
|
||||
public static final int MY_PERMISSIONS_REQUEST_READ_STORAGE = 0x245285a8;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -30,16 +31,16 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
|||
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ContextCompat.checkSelfPermission(this,android.Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
||||
//if (ContextCompat.checkSelfPermission(this,android.Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
// Permission is not granted
|
||||
|
||||
ActivityCompat.requestPermissions(this,new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_WRITE_STORAGE);
|
||||
// ActivityCompat.requestPermissions(this,new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_WRITE_STORAGE);
|
||||
|
||||
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
|
||||
// app-defined int constant. The callback method gets the
|
||||
// result of the request.
|
||||
} else {
|
||||
//} else {
|
||||
|
||||
System.loadLibrary("friendiqa_arm64-v8a");
|
||||
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
|
||||
|
@ -68,7 +69,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
|||
} else {
|
||||
SystemDispatcher.onActivityResume();
|
||||
}}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,10 +77,12 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
|||
|
||||
@Override public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case MY_PERMISSIONS_REQUEST_WRITE_STORAGE: {
|
||||
case MY_PERMISSIONS_REQUEST_READ_STORAGE: {
|
||||
// If request is cancelled, the result arrays are empty.
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
SystemDispatcher.onActivityResume();
|
||||
Map message = new HashMap();
|
||||
message.put("multiple",false);
|
||||
SystemDispatcher.dispatch("androidnative.ImagePicker.pickImage",message);
|
||||
} else {
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package androidnative;
|
||||
import org.qtproject.qt5.android.QtNative;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.app.Activity;
|
||||
import java.util.Map;
|
||||
|
@ -17,12 +18,20 @@ import android.content.ClipData;
|
|||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.Manifest.permission;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
|
||||
|
||||
public class ImagePicker {
|
||||
|
||||
// Random
|
||||
public static final int PICK_IMAGE_ACTION = 0x245285a3;
|
||||
public static final int TAKE_PHOTO_ACTION = 0x29fe8748;
|
||||
|
||||
public static final int MY_PERMISSIONS_REQUEST_READ_STORAGE = 0x245285a8;
|
||||
public static final String PICK_IMAGE_MESSAGE = "androidnative.ImagePicker.pickImage";
|
||||
public static final String TAKE_PHOTO_MESSAGE = "androidnative.ImagePicker.takePhoto";
|
||||
public static final String CHOSEN_MESSAGE = "androidnative.ImagePicker.chosen";
|
||||
|
@ -47,8 +56,15 @@ public class ImagePicker {
|
|||
}
|
||||
|
||||
static void pickImage(Map message) {
|
||||
Context context;
|
||||
context = QtNative.activity().getApplicationContext();
|
||||
Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
||||
if (ContextCompat.checkSelfPermission(context,android.Manifest.permission.READ_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission is not granted
|
||||
ActivityCompat.requestPermissions(activity,new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_READ_STORAGE);
|
||||
} else {
|
||||
Boolean multiple = false;
|
||||
Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
||||
//Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
|
||||
|
@ -63,7 +79,7 @@ public class ImagePicker {
|
|||
// >= API 18
|
||||
activity.startActivityForResult(intent, PICK_IMAGE_ACTION);
|
||||
|
||||
}
|
||||
}}
|
||||
|
||||
static void takePhoto(Map message) {
|
||||
if (message.containsKey("broadcast")) {
|
||||
|
|
115
source-android/common/filesystemandroid.cpp
Normal file
115
source-android/common/filesystemandroid.cpp
Normal file
|
@ -0,0 +1,115 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// 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 "filesystem.h"
|
||||
#include <QtAndroidExtras>
|
||||
|
||||
|
||||
FILESYSTEM *FILESYSTEM::instance()
|
||||
{
|
||||
static FILESYSTEM filesystem;
|
||||
return &filesystem;
|
||||
}
|
||||
|
||||
FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){}
|
||||
|
||||
void FILESYSTEM::setDirectory(QString Directory)
|
||||
{
|
||||
if (Directory!=m_Directory) {
|
||||
m_Directory = Directory;
|
||||
emit directoryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString FILESYSTEM::Directory() const
|
||||
{
|
||||
return m_Directory;
|
||||
}
|
||||
|
||||
QString FILESYSTEM::homePath() const
|
||||
{
|
||||
QAndroidJniObject activity =QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative","activity", "()Landroid/app/Activity;");
|
||||
QAndroidJniObject dir = activity.callObjectMethod("getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;", NULL);
|
||||
QString homeDir=dir.toString();
|
||||
return homeDir;
|
||||
}
|
||||
|
||||
bool FILESYSTEM::fileexist(QString name)
|
||||
{ return QFile::exists(name);
|
||||
}
|
||||
|
||||
void FILESYSTEM::makeDir(QString name)
|
||||
{
|
||||
QDir dir(m_Directory);
|
||||
if (dir.mkdir(name)){
|
||||
emit success(name);
|
||||
}
|
||||
else {
|
||||
emit error(name,1);
|
||||
}
|
||||
}
|
||||
|
||||
void FILESYSTEM::makePath(QString name)
|
||||
{
|
||||
QDir dir(m_Directory);
|
||||
if (dir.mkpath(name)){
|
||||
emit success(name);
|
||||
}
|
||||
else {
|
||||
emit error(name,1);}
|
||||
}
|
||||
|
||||
void FILESYSTEM::rmDir()
|
||||
{
|
||||
QDir dir(m_Directory);
|
||||
if (dir.removeRecursively()){
|
||||
emit success(m_Directory);
|
||||
}
|
||||
else {emit error(m_Directory,1);}
|
||||
}
|
||||
|
||||
void FILESYSTEM::rmFile(QString name)
|
||||
{
|
||||
QDir dir(m_Directory);
|
||||
if(dir.remove(name)){
|
||||
emit success(name);
|
||||
}
|
||||
else {emit error(name,1);}
|
||||
}
|
||||
QFileInfoList FILESYSTEM::fileList()
|
||||
{
|
||||
QDir dir(m_Directory);
|
||||
QStringList filters;
|
||||
filters << "*.png" <<"*.PNG" << "*.jpg" << "*.JPG" << "*.JPEG";
|
||||
dir.setNameFilters(filters);
|
||||
dir.setSorting(QDir::Time | QDir::Reversed);
|
||||
return dir.entryInfoList();
|
||||
}
|
|
@ -38,9 +38,6 @@
|
|||
#include "filesystem.h"
|
||||
#include "remoteauthasyncimageprovider.h"
|
||||
#include "AndroidNative/systemdispatcher.h"
|
||||
//#include "AndroidNative/environment.h"
|
||||
//#include "AndroidNative/debug.h"
|
||||
//#include "AndroidNative/mediascannerconnection.h"
|
||||
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
@ -87,7 +84,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) {
|
|||
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
|
||||
//QtWebEngine::initialize();
|
||||
view.show();
|
||||
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ QT += qml quick gui widgets androidextras sql webview #webengine
|
|||
include(androidnative.pri/androidnative.pri)
|
||||
|
||||
SOURCES += common/friendiqa.cpp \
|
||||
common/uploadableimage.cpp \
|
||||
common/uploadableimage.cpp \
|
||||
common/xhr.cpp \
|
||||
common/filesystem.cpp \
|
||||
common/filesystemandroid.cpp \
|
||||
common/remoteauthasyncimageprovider.cpp \
|
||||
common/updatenews.cpp \
|
||||
common/alarmandroid.cpp
|
||||
|
@ -84,3 +84,6 @@ DISTFILES += \
|
|||
android/src/FriendiqaService.java
|
||||
|
||||
ANDROID_EXTRA_LIBS = $$PWD/android/arm/libcrypto_1_1.so $$PWD/android/arm/libssl_1_1.so $$PWD/android/arm64/libcrypto_1_1.so $$PWD/android/arm64/libssl_1_1.so
|
||||
|
||||
ANDROID_ABIS = arm64-v8a
|
||||
android: include(/home/pankraz/git/android_openssl/openssl.pri)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue