mirror of
https://gitlab.com/neothefox/LayTray
synced 2026-03-23 21:54:54 +03:00
Update icon as settings change
Better text centering
This commit is contained in:
parent
f312ffb047
commit
cb77503a63
@ -24,7 +24,6 @@ dependencies {
|
|||||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||||
implementation 'com.android.support:support-v4:26.1.0'
|
implementation 'com.android.support:support-v4:26.1.0'
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
implementation 'com.android.support:design:26.1.0'
|
implementation 'com.android.support:design:26.1.0'
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import android.graphics.Color;
|
|||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffXfermode;
|
import android.graphics.PorterDuffXfermode;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -48,7 +49,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
layouts = getSharedPreferences("layouts", 0);
|
layouts = getSharedPreferences("layouts", 0);
|
||||||
options = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
options = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
lastToast = "EMPT";
|
lastToast = "EMPT";
|
||||||
//options.registerOnSharedPreferenceChangeListener(this);
|
options.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
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) {
|
||||||
@ -120,7 +121,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
paint.setColor(Color.TRANSPARENT);
|
paint.setColor(Color.TRANSPARENT);
|
||||||
paint.setTextSize(textSize);
|
paint.setTextSize(textSize);
|
||||||
paint.setTextAlign(Paint.Align.CENTER);
|
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;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
paint.setColor(Color.TRANSPARENT);
|
paint.setColor(Color.TRANSPARENT);
|
||||||
paint.setTextSize(textSize);
|
paint.setTextSize(textSize);
|
||||||
paint.setTextAlign(Paint.Align.CENTER);
|
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;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
paint.setColor(textColor);
|
paint.setColor(textColor);
|
||||||
paint.setTextSize(textSize);
|
paint.setTextSize(textSize);
|
||||||
paint.setTextAlign(Paint.Align.CENTER);
|
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;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user