-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from mindbox-cloud/release/2.10.2-rc
Release/2.10.2-rc
- Loading branch information
Showing
8 changed files
with
131 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
sdk/src/main/java/cloud/mindbox/mobile_sdk/utils/ImagePushSizeManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package cloud.mindbox.mobile_sdk.utils | ||
|
||
import android.content.res.Resources | ||
import android.os.Build | ||
import cloud.mindbox.mobile_sdk.px | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_31_PLUS_TITLE_2_STRING = 250 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_31_WITH_BUTTONS_TITLE_2_STRING = 190 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_31_PLUS = 270 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_31_WITH_BUTTONS = 220 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_28_30 = 175 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_28_30_WITH_BUTTONS = 135 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_24_27 = 180 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_24_27_WITH_BUTTONS = 120 | ||
private const val EXPANDED_PUSH_IMAGE_HEIGHT_23_AND_LESS = 130 | ||
private const val MARGIN_ANDROID_30_AND_LESS = 32 | ||
private const val CHAR_COUNT_WHEN_TITLE_2_STRING = 35 | ||
|
||
internal val imageWidthInPixels: Int | ||
get() { | ||
return runCatching { | ||
val defaultWidth = Resources.getSystem().displayMetrics.widthPixels | ||
return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) defaultWidth - MARGIN_ANDROID_30_AND_LESS.px else defaultWidth | ||
}.getOrElse { 0 } | ||
} | ||
|
||
fun getImageHeightWithoutButtonIxPixels(charCountInTitle: Int): Int { | ||
return when { | ||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> | ||
if (charCountInTitle <= CHAR_COUNT_WHEN_TITLE_2_STRING) | ||
EXPANDED_PUSH_IMAGE_HEIGHT_31_PLUS | ||
else EXPANDED_PUSH_IMAGE_HEIGHT_31_PLUS_TITLE_2_STRING | ||
Build.VERSION.SDK_INT in Build.VERSION_CODES.P..Build.VERSION_CODES.R -> EXPANDED_PUSH_IMAGE_HEIGHT_28_30 | ||
Build.VERSION.SDK_INT in Build.VERSION_CODES.N..Build.VERSION_CODES.O_MR1 -> EXPANDED_PUSH_IMAGE_HEIGHT_24_27 | ||
else -> EXPANDED_PUSH_IMAGE_HEIGHT_23_AND_LESS | ||
}.px | ||
} | ||
|
||
fun getImageHeightWithButtonIxPixels(charCountInTitle: Int): Int { | ||
return when { | ||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> | ||
if (charCountInTitle <= CHAR_COUNT_WHEN_TITLE_2_STRING) | ||
EXPANDED_PUSH_IMAGE_HEIGHT_31_WITH_BUTTONS | ||
else EXPANDED_PUSH_IMAGE_HEIGHT_31_WITH_BUTTONS_TITLE_2_STRING | ||
Build.VERSION.SDK_INT in Build.VERSION_CODES.P..Build.VERSION_CODES.R -> EXPANDED_PUSH_IMAGE_HEIGHT_28_30_WITH_BUTTONS | ||
Build.VERSION.SDK_INT in Build.VERSION_CODES.N..Build.VERSION_CODES.O_MR1 -> EXPANDED_PUSH_IMAGE_HEIGHT_24_27_WITH_BUTTONS | ||
else -> EXPANDED_PUSH_IMAGE_HEIGHT_23_AND_LESS | ||
}.px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<bool name="mindbox_use_central_inside_notification_scale">true</bool> | ||
</resources> |