Quick GUI: Change theming to use green colors
This commit is contained in:
parent
08268f50ee
commit
c090141ec3
|
@ -48,14 +48,6 @@ public class Activity extends QtActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyTheming() {
|
|
||||||
Window window = getWindow();
|
|
||||||
window.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
||||||
window.clearFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
|
||||||
window.setStatusBarColor(0x000000FF);
|
|
||||||
window.setNavigationBarColor(0x000000FF);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
|
|
|
@ -19,11 +19,29 @@ using namespace ConversionUtilities;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
|
namespace Android {
|
||||||
|
namespace WindowManager {
|
||||||
|
namespace LayoutParams {
|
||||||
|
enum RelevantFlags {
|
||||||
|
TranslucentStatus = 0x04000000,
|
||||||
|
DrawsSystemBarBackgrounds = 0x80000000,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} // namespace WindowManager
|
||||||
|
} // namespace Android
|
||||||
|
|
||||||
static Controller *controllerForAndroid = nullptr;
|
static Controller *controllerForAndroid = nullptr;
|
||||||
|
|
||||||
void applyThemingForAndroid()
|
void applyThemingForAndroid()
|
||||||
{
|
{
|
||||||
QtAndroid::androidActivity().callMethod<void>("applyTheming", "()");
|
QtAndroid::runOnAndroidThread([=]() {
|
||||||
|
const auto color = QColor(QLatin1String("#2c714a")).rgba();
|
||||||
|
QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;");
|
||||||
|
window.callMethod<void>("addFlags", "(I)V", Android::WindowManager::LayoutParams::DrawsSystemBarBackgrounds);
|
||||||
|
window.callMethod<void>("clearFlags", "(I)V", Android::WindowManager::LayoutParams::TranslucentStatus);
|
||||||
|
window.callMethod<void>("setStatusBarColor", "(I)V", color);
|
||||||
|
window.callMethod<void>("setNavigationBarColor", "(I)V", color);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerControllerForAndroid(Controller *controller)
|
void registerControllerForAndroid(Controller *controller)
|
||||||
|
|
|
@ -12,11 +12,12 @@ namespace QtGui {
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
|
|
||||||
void applyThemingForAndroid();
|
bool applyThemingForAndroid();
|
||||||
void registerControllerForAndroid(Controller *controller);
|
void registerControllerForAndroid(Controller *controller);
|
||||||
bool showAndroidFileDialog(bool existing);
|
bool showAndroidFileDialog(bool existing);
|
||||||
int openFileDescriptorFromAndroidContentUrl(const QString &url, const QString &mode);
|
int openFileDescriptorFromAndroidContentUrl(const QString &url, const QString &mode);
|
||||||
void writeToAndroidLog(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
void writeToAndroidLog(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||||
|
void setupAndroidSpecifics();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,24 +30,11 @@ using namespace ApplicationUtilities;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
namespace Android {
|
|
||||||
namespace WindowManager {
|
|
||||||
namespace LayoutParams {
|
|
||||||
enum RelevantFlags {
|
|
||||||
TranslucentStatus = 0x04000000,
|
|
||||||
DrawsSystemBarBackgrounds = 0x80000000,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} // namespace WindowManager
|
|
||||||
} // namespace Android
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &file)
|
int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &file)
|
||||||
{
|
{
|
||||||
// setup logging for Android
|
// setup Android-specifics (logging, theming)
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
qInstallMessageHandler(writeToAndroidLog);
|
setupAndroidSpecifics();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init application
|
// init application
|
||||||
|
@ -100,10 +87,6 @@ int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, c
|
||||||
context->setContextProperty(QStringLiteral("dependencyVersions"), QStringList(DEPENCENCY_VERSIONS));
|
context->setContextProperty(QStringLiteral("dependencyVersions"), QStringList(DEPENCENCY_VERSIONS));
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
applyThemingForAndroid();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// run event loop
|
// run event loop
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[Material]
|
[Material]
|
||||||
Primary=#000000
|
Primary=#2c714a
|
||||||
Accent=#000000
|
Accent=#2c8352
|
||||||
Theme=System
|
Theme=System
|
||||||
|
|
||||||
[Universal]
|
[Universal]
|
||||||
Accent=#000000
|
Primary=#2c714a
|
||||||
|
Accent=#2c8352
|
||||||
Theme=System
|
Theme=System
|
||||||
|
|
Loading…
Reference in New Issue