Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardia Daneshvar committed Mar 2, 2017
1 parent e4c2f1f commit be07b1e
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 11 deletions.
3 changes: 3 additions & 0 deletions android-build/res/values/style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">centerCrop</item>
</style>

<!--
Expand Down
2 changes: 0 additions & 2 deletions android-build/src/land/aseman/android/AsemanActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ public String getPath(Uri uri) {
public void onCreate(Bundle savedInstanceState)
{
Window w = getWindow();
w.getDecorView().setBackgroundColor(0xff111111);

int resID = getResources().getIdentifier("splash" , "drawable", getPackageName());
if(resID != 0)
w.setBackgroundDrawableResource(resID);
Expand Down
21 changes: 17 additions & 4 deletions asemanapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,26 @@ AsemanApplication::AsemanApplication(int &argc, char **argv, ApplicationType app
if(!aseman_app_singleton)
aseman_app_singleton = this;

#ifdef Q_OS_ANDROID
#ifndef FORCE_ASEMAN_DENSITY
#ifdef Q_OS_ANDROID
const bool nexus5X = (AsemanJavaLayer::instance()->deviceName() == "LGE Nexus 5X");
if(!nexus5X)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

if(!QGuiApplication::testAttribute(Qt::AA_EnableHighDpiScaling) && qgetenv("QT_SCALE_FACTOR").isNull() && qgetenv("ASEMAN_SCALE_FACTOR").isNull())
{
qreal ratio = AsemanJavaLayer::instance()->density()*(AsemanDevices::isTablet()? 1.28 : 1);
qreal newRatio = qRound((ratio*20) + 0.01)/20.0;
qputenv("QT_SCALE_FACTOR",QByteArray::number(newRatio));
qputenv("ASEMAN_SCALE_FACTOR",QByteArray::number(ratio/newRatio));
if(nexus5X)
{
qreal newRatio = qRound((ratio*20) + 0.01)/20.0;
qputenv("QT_SCALE_FACTOR",QByteArray::number(newRatio));
qputenv("ASEMAN_SCALE_FACTOR",QByteArray::number(ratio/newRatio));
}
else
qputenv("QT_SCALE_FACTOR",QByteArray::number(ratio));
}
#else
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
#endif

Expand Down Expand Up @@ -218,11 +229,13 @@ AsemanApplication::AsemanApplication(int &argc, char **argv, ApplicationType app

void AsemanApplication::init()
{
#ifndef FORCE_ASEMAN_DENSITY
if(!qgetenv("ASEMAN_SCALE_FACTOR").isNull())
AsemanDevices::setFlag(AsemanDevices::AsemanScaleFactorEnable);
else
if(!qgetenv("QT_SCALE_FACTOR").isNull())
AsemanDevices::setFlag(AsemanDevices::DisableDensities);
#endif

switch(p->appType)
{
Expand Down
11 changes: 7 additions & 4 deletions asemandevices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,11 @@ qreal AsemanDevices::standardTitleBarHeight() const
if(res)
return res;

if(isDesktop() || lcdPhysicalSize()<5)
res = 50*density()*1.2;
if(isDesktop())
res = 60*density();
else
if(isMobile())
res = 56*density();
else
res = 54*density();

Expand Down Expand Up @@ -474,12 +477,12 @@ qreal AsemanDevices::deviceDensity()
qreal AsemanDevices::fontDensity()
{
#ifdef Q_OS_ANDROID
qreal ratio = isMobile()? FONT_RATIO*1.25 : FONT_RATIO*1.35;
const qreal ratio = isMobile()? FONT_RATIO*1.25 : FONT_RATIO*1.35;
if(AsemanDevices::flag(AsemanScaleFactorEnable))
return density()*ratio;
else
if(AsemanDevices::flag(DisableDensities))
return ratio/FONT_RATIO;
return ratio;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
else
if(QGuiApplication::testAttribute(Qt::AA_EnableHighDpiScaling))
Expand Down
1 change: 1 addition & 0 deletions qml/AsemanTools/CachedImage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Item {
anchors.fill: parent
source: image
maskSource: mask
cached: true
}

FileDownloaderQueueItem {
Expand Down
1 change: 1 addition & 0 deletions qml/AsemanTools/Controls/Frame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Item {
horizontalOffset: 0
verticalOffset: 1
opacity: 0.4
cached: true
color: "#000000"
}

Expand Down
1 change: 1 addition & 0 deletions qml/AsemanTools/MaterialDesignButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ Item {
samples: 16
color: "#aa000000"
source: btn_rect
cached: true
}

MouseArea {
Expand Down
2 changes: 1 addition & 1 deletion qml/AsemanTools/SlidePageManager1_1.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Item {
property alias mainItem: scene.itemObject
readonly property variant currentItem: {
if(list.count == 0)
return null
return scene.itemObject
else
return list.last().itemObject
}
Expand Down
1 change: 1 addition & 0 deletions qml/AsemanTools/private/MaterialDesignButtonItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Item {
radius: 8.0
samples: 16
color: "#66000000"
cached: true
source: btn_rect
}

Expand Down

0 comments on commit be07b1e

Please sign in to comment.