mirror of
https://gitlab.com/neothefox/LayTray
synced 2026-03-23 21:54:54 +03:00
Improved icon visibility
Now a new unknown layout is going to be added automatically Added summary
This commit is contained in:
parent
6f70fc1a23
commit
03bb19a559
@ -20,6 +20,7 @@
|
||||
android:name=".IconService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:summary="A simple keyboard layout indicator for physical keyboards"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||
|
||||
<intent-filter>
|
||||
|
||||
@ -50,15 +50,23 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
|
||||
protected void updateNotification(String toast)
|
||||
{
|
||||
Notification icon;
|
||||
Icon smallIcon = Icon.createWithBitmap(textAsBitmap(layouts.getString(toast, "??"), 30, Color.WHITE));
|
||||
Notification indicator;
|
||||
String textIcon = layouts.getString(toast,"EMPT");
|
||||
if(textIcon == "EMPT")
|
||||
{
|
||||
SharedPreferences.Editor layoutsEditor = layouts.edit();
|
||||
layoutsEditor.putString(toast, "??");
|
||||
layoutsEditor.commit();
|
||||
textIcon = "??";
|
||||
}
|
||||
Icon smallIcon = Icon.createWithBitmap(textAsBitmap(textIcon, 48, Color.WHITE));
|
||||
|
||||
icon = new Notification.Builder(this)
|
||||
indicator = new Notification.Builder(this)
|
||||
.setSmallIcon(smallIcon)
|
||||
.setContentTitle(toast)
|
||||
.setOngoing(true)
|
||||
.build();
|
||||
iconManager.notify(0, icon);
|
||||
iconManager.notify(0, indicator);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -66,6 +74,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
public Bitmap textAsBitmap(String text, float textSize, int textColor) {
|
||||
Paint paint = new Paint(ANTI_ALIAS_FLAG);
|
||||
paint.setTextSize(textSize);
|
||||
paint.setFakeBoldText(true);
|
||||
paint.setColor(textColor);
|
||||
paint.setTextAlign(Paint.Align.LEFT);
|
||||
float baseline = -paint.ascent(); // ascent() is negative
|
||||
|
||||
3
app/src/main/res/values/dimens.xml
Normal file
3
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user