Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Datovka projects
mobile Datovka
Commits
578c564d
Commit
578c564d
authored
Dec 14, 2018
by
Martin Straka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test on system SDK version
parent
f643cc46
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
8 deletions
+40
-8
android/src/android_io.cpp
android/src/android_io.cpp
+11
-6
android/src/android_io.h
android/src/android_io.h
+24
-2
android/src/cz/nic/mobiledatovka/java/QFileProvider.java
android/src/cz/nic/mobiledatovka/java/QFileProvider.java
+5
-0
No files found.
android/src/android_io.cpp
View file @
578c564d
...
...
@@ -33,16 +33,21 @@ AndroidIO::AndroidIO(void)
{
}
bool
AndroidIO
::
openFile
(
const
QString
&
filePath
)
bool
AndroidIO
::
isSDKVersion24OrNewest
(
void
)
{
jboolean
ok
=
QAndroidJniObject
::
callStaticMethod
<
jboolean
>
(
"cz/nic/mobiledatovka/java/QFileProvider"
,
"isSDKVersion24OrNewest"
);
/* TOTO: ADD test: if (SDK >= 24) { use FileProvide } else { use QDesktopServices } */
return
(
ok
);
}
#if 0
bool
AndroidIO
::
openFile
(
const
QString
&
filePath
)
{
if
(
isSDKVersion24OrNewest
())
{
return
openWithFileProvider
(
filePath
);
}
return
openWithQDesktopServices
(
filePath
);
#else
return
openWithFileProvider
(
filePath
);
#endif
}
bool
AndroidIO
::
openWithQDesktopServices
(
const
QString
&
filePath
)
...
...
android/src/android_io.h
View file @
578c564d
...
...
@@ -43,17 +43,39 @@ public:
explicit
AndroidIO
(
void
);
/*!
* @brief
Obtain intent arguments
.
* @brief
Check if Android OS SDK Version is level 24 or newest
.
*
* @return List of files to be opened.
* @return True if SDK Version is 24 or higher.
*/
static
bool
isSDKVersion24OrNewest
(
void
);
/*!
* @brief Open file.
*
* @param[in] filePath File path.
* @return True if success.
*/
static
bool
openFile
(
const
QString
&
filePath
);
private:
/*!
* @brief Open file with QDesktopService.
*
* @param[in] filePath File path.
* @return True if success.
*/
static
bool
openWithQDesktopServices
(
const
QString
&
filePath
);
/*!
* @brief Open file with Java file provider.
*
* @param[in] filePath File path.
* @return True if success.
*/
static
bool
openWithFileProvider
(
const
QString
&
filePath
);
};
android/src/cz/nic/mobiledatovka/java/QFileProvider.java
View file @
578c564d
...
...
@@ -60,6 +60,11 @@ public class QFileProvider
protected
QFileProvider
()
{}
public
static
boolean
isSDKVersion24OrNewest
()
{
// 24 and newest use fileprovider only
return
(
Build
.
VERSION
.
SDK_INT
>=
24
);
}
public
static
boolean
startActivity
(
Intent
theIntent
,
Uri
uri
)
{
final
Context
context
=
QtNative
.
activity
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment