Commit 72167507 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Use densityDpi instead of xdpi for icon sizes

parent 6c2b9e60
Pipeline #81050 passed with stage
in 6 minutes and 18 seconds
...@@ -44,6 +44,8 @@ build/ ...@@ -44,6 +44,8 @@ build/
.idea/modules.xml .idea/modules.xml
.idea/assetWizardSettings.xml .idea/assetWizardSettings.xml
.idea/markdown-navigator* .idea/markdown-navigator*
.idea/compiler.xml
.idea/jarRepositories.xml
projectFilesBackup/ projectFilesBackup/
gradle.xml gradle.xml
......
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS"> <option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value> <value>
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" /> <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value> </value>
</option> </option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" /> <option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings> </JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<XML> <XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML> </XML>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project> </project>
\ No newline at end of file
...@@ -10,7 +10,6 @@ import android.graphics.Point; ...@@ -10,7 +10,6 @@ import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.WindowManager; import android.view.WindowManager;
...@@ -158,8 +157,8 @@ public class DeviceProfile { ...@@ -158,8 +157,8 @@ public class DeviceProfile {
display.getRealSize(realSize); display.getRealSize(realSize);
widthPx = realSize.x; widthPx = realSize.x;
double x = widthPx / dm.xdpi; double x = widthPx / dm.densityDpi;
ratio = dm.densityDpi / dm.xdpi; ratio = (float) dm.densityDpi / dm.xdpi;
widthCm = (float) (x * 2.540001f); widthCm = (float) (x * 2.540001f);
heightPx = realSize.y; heightPx = realSize.y;
...@@ -237,13 +236,7 @@ public class DeviceProfile { ...@@ -237,13 +236,7 @@ public class DeviceProfile {
float a = 1.578f; float a = 1.578f;
float b = 1.23f; float b = 1.23f;
Log.i(TAG, "updateIconSize: " + (int) a + " " + (int) b); iconSizePx = (int) (0.75 * widthPx / widthCm);
iconSizePx = (int) (widthPx / widthCm);
if (ratio >= 1) {
iconSizePx = iconSizePx * (int) ratio;
}
iconTextSizePx = (int) (Utilities.pxFromSp(12, dm) * scale); iconTextSizePx = (int) (Utilities.pxFromSp(12, dm) * scale);
iconDrawablePaddingPx = (availableWidthPx - iconSizePx * 4) / 5; iconDrawablePaddingPx = (availableWidthPx - iconSizePx * 4) / 5;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment