1
0
mirror of https://gitlab.com/neothefox/LayTray synced 2026-03-23 21:54:54 +03:00

Better NotificationChannel handling

Bumped the version to 1.8
This commit is contained in:
NeoTheFox 2018-07-27 19:59:18 +03:00
parent bccc0bca6c
commit 85ee301a16
5 changed files with 17 additions and 11 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "space.neothefox.laytray" applicationId "space.neothefox.laytray"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 26 targetSdkVersion 26
versionCode 8 versionCode 9
versionName "1.7" versionName "1.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View File

@ -54,15 +54,18 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
iconManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); iconManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconChannel = new NotificationChannel( iconChannel = iconManager.getNotificationChannel(channelId);
channelId, if(iconChannel == null) {
"LayTray IconChannel", iconChannel = new NotificationChannel(
NotificationManager.IMPORTANCE_DEFAULT); channelId,
iconChannel.setShowBadge(false); getString(R.string.title_icon_channel),
iconChannel.enableLights(false); NotificationManager.IMPORTANCE_DEFAULT);
iconChannel.enableVibration(false); iconChannel.setShowBadge(false);
iconChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); iconChannel.enableLights(false);
iconManager.createNotificationChannel(iconChannel); iconChannel.enableVibration(false);
iconChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
iconManager.createNotificationChannel(iconChannel);
}
} }
} }

View File

@ -55,4 +55,5 @@
<string name="title_about">Аб праграме</string> <string name="title_about">Аб праграме</string>
<string name="close">Зачыніць</string> <string name="close">Зачыніць</string>
<string name="unsupported_device">Тэлефон не падтрымліваецца</string> <string name="unsupported_device">Тэлефон не падтрымліваецца</string>
<string name="title_icon_channel">онкa раскладкі</string>
</resources> </resources>

View File

@ -55,4 +55,5 @@
<string name="title_about">О программе</string> <string name="title_about">О программе</string>
<string name="close">Закрыть</string> <string name="close">Закрыть</string>
<string name="unsupported_device">Телефон не поддерживается</string> <string name="unsupported_device">Телефон не поддерживается</string>
<string name="title_icon_channel">Иконка раскладки</string>
</resources> </resources>

View File

@ -8,6 +8,7 @@
<string name="unsupported_device">Unsupported phone</string> <string name="unsupported_device">Unsupported phone</string>
<string name="unsupported_device_description" translatable="false">This phone is missing the BlackBerry Keyboard. LayTray will not work without it.</string> <string name="unsupported_device_description" translatable="false">This phone is missing the BlackBerry Keyboard. LayTray will not work without it.</string>
<string name="close">Close</string> <string name="close">Close</string>
<string name="title_icon_channel">Layout icon</string>
<!-- Strings related to Settings --> <!-- Strings related to Settings -->
<!-- Example General settings --> <!-- Example General settings -->