OpenLauncherTeam / openlauncher

Customizable and Open Source Launcher for Android
Apache License 2.0
1.41k stars 413 forks source link

Notification Badge on wired position #536

Open notavailable2 opened 4 years ago

notavailable2 commented 4 years ago

General Information

OpenLauncher Version: 0.7.2 Android Version: 10 Custom ROM: LineageOS 17.0 Install Source: F-Droid

Description

The red notification dots appears somewhere in the lower half of the icons. On the right side but not in the top corner where i would expect them. See screenshot.

Screenshot_20191209-082206_OpenLauncher-scaleddown

hobleyd commented 4 years ago

That's weird; they sit at the top right for me. Let me take a look and I'll get back to you.

notavailable2 commented 4 years ago

Can you point out in which file/function the dot is painted ?

hobleyd commented 4 years ago

AppItemView.java -> onDraw()

if (_notificationCount > 0) { float radius = _iconSize * .15f; canvas.drawCircle(_iconSize - radius, _heightPadding, radius, _notifyPaint); }

notavailable2 commented 4 years ago

thank you.

they sit at the top right for me.

yes they do on default setup. if you remove "position indicator", "show labels", "search bar", or change number of rows, they are offset.

with your hint i at least could make a dirty version for myself by removing some numbers from y.

hobleyd commented 4 years ago

Perfect - that makes sense. The new line required is: canvas.drawCircle(_iconSize - radius, radius, radius, _notifyPaint); If you could confirm that works for you, I'll submit a PR.

notavailable2 commented 4 years ago

yes, that worked.

may i propose following version, which shows the notification-count and places the dot a bit outside the icon. see attachment.

    _notifyPaint.setAntiAlias(true);
    canvas.drawCircle(_iconSize - (radius/2), radius/2, radius, _notifyPaint);
    if (_notificationCount>9) {_notificationCount=9;}
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.rgb(255,255,255));
    paint.setTextSize((int) (radius*2));
    canvas.drawText(String.valueOf(_notificationCount), _iconSize - radius, radius+(radius/8), paint);

Screenshot_OpenLauncher

hobleyd commented 4 years ago

OK, I have added in the suggested change to put numbers in the notification label (I made a couple of changes from your suggested code, sorry). Great suggestion, thanks.

PR has been submitted (#539).

notavailable2 commented 4 years ago

TNX for the fixes