mirror of
https://gitlab.com/neothefox/LayTray
synced 2026-06-13 22:40:48 +03:00
Update icon as settings change
Better text centering
This commit is contained in:
@@ -13,6 +13,7 @@ import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.Build;
|
||||
@@ -48,7 +49,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
layouts = getSharedPreferences("layouts", 0);
|
||||
options = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
lastToast = "EMPT";
|
||||
//options.registerOnSharedPreferenceChangeListener(this);
|
||||
options.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
iconManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@@ -120,7 +121,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
paint.setColor(Color.TRANSPARENT);
|
||||
paint.setTextSize(textSize);
|
||||
paint.setTextAlign(Paint.Align.CENTER);
|
||||
canvas.drawText(text, width / 2f, height / 2f + textSize / 2f, paint);
|
||||
canvas.drawText(text, width/2f, ((height/2f) - (paint.descent()+paint.ascent())/2f), paint);
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -134,7 +135,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
paint.setColor(Color.TRANSPARENT);
|
||||
paint.setTextSize(textSize);
|
||||
paint.setTextAlign(Paint.Align.CENTER);
|
||||
canvas.drawText(text, width / 2f, height / 2f + textSize / 2f, paint);
|
||||
canvas.drawText(text, width / 2f, ((height/2f) - (paint.descent()+paint.ascent())/2f), paint);
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
paint.setColor(textColor);
|
||||
paint.setTextSize(textSize);
|
||||
paint.setTextAlign(Paint.Align.CENTER);
|
||||
canvas.drawText(text, width / 2f, height / 2f + textSize / 2f, paint);
|
||||
canvas.drawText(text, width / 2f, ((height/2f) - (paint.descent()+paint.ascent())/2f), paint);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user