Skip to content

Commit

Permalink
Merge pull request #2328 from marunjar/improve_notification_dot
Browse files Browse the repository at this point in the history
improve notification dots
  • Loading branch information
marunjar authored Oct 3, 2024
2 parents dce0f52 + ec03fad commit bbb9070
Show file tree
Hide file tree
Showing 18 changed files with 129 additions and 139 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/fr/neamar/kiss/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class SettingsActivity extends PreferenceActivity implements
"pref-rounded-list", "pref-rounded-bars", "pref-swap-kiss-button-with-menu", "pref-hide-circle", "history-hide",
"enable-favorites-bar", "notification-bar-color", "black-notification-icons", "icons-pack", "theme-shadow",
"theme-separator", "theme-result-color", "large-favorites-bar", "pref-hide-search-bar-hint", "theme-wallpaper",
"theme-bar-color", "results-size", "large-result-list-margins", "themed-icons", null);
"theme-bar-color", "results-size", "large-result-list-margins", "themed-icons", "icons-hide", null);
// Those settings require a restart of the settings
final static private List<String> settingsRequiringRestartForSettingsActivity = Arrays.asList("theme", "force-portrait", null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ private static void applyTheme(Activity act, SharedPreferences prefs) {
act.getTheme().applyStyle(R.style.OverlayResultSizeStandard, true);
break;
}

if (prefs.getBoolean("icons-hide", false)) {
act.getTheme().applyStyle(R.style.OverlayResultSizeNoIcons, true);
}
}

public static void applySettingsTheme(Activity act, SharedPreferences prefs) {
Expand Down
25 changes: 17 additions & 8 deletions app/src/main/java/fr/neamar/kiss/result/SearchResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,28 @@ public View display(Context context, View view, @NonNull ViewGroup parent, Fuzzy
int pos;
int len;

boolean hideIcons = getHideIcons(context);
if (hideIcons) {
image.setImageDrawable(null);
}

switch (pojo.type) {
case URL_QUERY:
text = String.format(context.getString(R.string.ui_item_visit), this.pojo.getName());
pos = text.indexOf(this.pojo.getName());
len = this.pojo.getName().length();
image.setImageResource(R.drawable.ic_public);
if (!hideIcons) {
image.setImageResource(R.drawable.ic_public);
}
break;
case SEARCH_QUERY:
text = String.format(context.getString(R.string.ui_item_search), this.pojo.getName(), pojo.query);
pos = text.indexOf(pojo.query);
len = pojo.query.length();
image.setImageResource(R.drawable.search);
if (!hideIcons) {
image.setImageResource(R.drawable.search);
}

boolean hideIcons = getHideIcons(context);
if (isGoogleSearch() && !hideIcons) {
Drawable icon = getIconByPackageName(context, "com.google.android.googlequicksearchbox");
if (icon != null) {
Expand All @@ -86,7 +94,7 @@ public View display(Context context, View view, @NonNull ViewGroup parent, Fuzzy
}
}

if (!hasCustomIcon) {
if (!hasCustomIcon && !hideIcons) {
Intent intent = createSearchQueryIntent();
Drawable icon = getIconByIntent(context, intent);
if (icon != null) {
Expand All @@ -99,15 +107,16 @@ public View display(Context context, View view, @NonNull ViewGroup parent, Fuzzy
text = pojo.query;
pos = text.indexOf("=");
len = text.length() - pos;
image.setImageResource(R.drawable.ic_functions);
if (!hideIcons) {
image.setImageResource(R.drawable.ic_functions);
}
break;
case URI_QUERY:
text = String.format(context.getString(R.string.ui_item_open), this.pojo.query);
pos = text.indexOf(pojo.query);
len = pojo.query.length();
image.setImageResource(R.drawable.ic_public);

if (!getHideIcons(context)) {
if (!hideIcons) {
image.setImageResource(R.drawable.ic_public);
Intent intent = createSearchQueryIntent();
Drawable icon = getIconByIntent(context, intent);
if (icon != null) {
Expand Down
Binary file removed app/src/main/res/drawable-hdpi/dots.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/dots.png
Binary file not shown.
9 changes: 3 additions & 6 deletions app/src/main/res/drawable/notification_dot.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
<shape>
<solid android:color="@android:color/transparent" />
<size
android:width="48dp"
android:height="48dp" />
android:width="18dp"
android:height="18dp" />
</shape>
</item>
<item
android:gravity="top|end"
android:right="2dp"
android:top="2dp">
<item android:gravity="center">
<shape android:shape="oval">
<solid android:color="#666666" />
<size
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/notification_dot_favorite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@android:color/transparent" />
<size
android:width="48dp"
android:height="48dp" />
</shape>
</item>
<item
android:bottom="2dp"
android:gravity="top|end"
android:left="2dp"
android:right="2dp"
android:top="2dp">
<shape android:shape="oval">
<solid android:color="#666666" />
<size
android:width="14dp"
android:height="14dp" />
</shape>
</item>
</layer-list>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/favorite_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:contentDescription="@null"
android:src="@drawable/notification_dot"
android:src="@drawable/notification_dot_favorite"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
34 changes: 10 additions & 24 deletions app/src/main/res/layout/item_app.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/result_margin_left"
android:paddingLeft="@dimen/result_margin_left"
android:paddingTop="@dimen/result_margin_top"
android:paddingEnd="@dimen/result_margin_right"
android:paddingRight="@dimen/result_margin_right"
android:paddingBottom="@dimen/result_margin_bottom">
style="@style/ResultItem"
android:orientation="horizontal">

<FrameLayout
android:layout_width="?attr/resultIconSize"
android:layout_height="?attr/resultIconSize"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="@dimen/icon_margin_left"
android:layout_marginLeft="@dimen/icon_margin_left"
android:layout_marginTop="@dimen/icon_margin_top"
android:layout_marginEnd="@dimen/icon_margin_right"
android:layout_marginRight="@dimen/icon_margin_right"
android:layout_marginBottom="@dimen/icon_margin_bottom">
style="@style/ResultItemIcon"
android:layout_gravity="start|center_vertical">

<ImageView
android:id="@+id/item_app_icon"
Expand All @@ -32,8 +17,9 @@

<ImageView
android:id="@+id/item_notification_dot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="?attr/resultNotificationDotSize"
android:layout_height="?attr/resultNotificationDotSize"
android:layout_gravity="top|end"
android:contentDescription="@null"
android:src="@drawable/notification_dot"
android:visibility="gone"
Expand All @@ -42,7 +28,7 @@

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:gravity="center_vertical"
android:orientation="vertical">
Expand All @@ -62,7 +48,7 @@
android:textColor="?attr/resultColor"
android:textDirection="locale"
android:textSize="?attr/resultTitleSize"
tools:ignore="RtlSymmetry"
tools:ignore="RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_application" />

<TextView
Expand All @@ -80,7 +66,7 @@
android:textColor="?android:attr/textColorSecondary"
android:textDirection="locale"
android:textSize="?attr/resultSubtitleSize"
tools:ignore="RtlSymmetry"
tools:ignore="RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_app_tag" />

</LinearLayout>
Expand Down
27 changes: 6 additions & 21 deletions app/src/main/res/layout/item_contact.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/ResultItem"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/result_margin_left"
android:paddingLeft="@dimen/result_margin_left"
android:paddingTop="@dimen/result_margin_top"
android:paddingEnd="@dimen/result_margin_right"
android:paddingRight="@dimen/result_margin_right"
android:paddingBottom="@dimen/result_margin_bottom">
android:orientation="horizontal">

<fr.neamar.kiss.ui.ImprovedQuickContactBadge
android:id="@+id/item_contact_icon"
android:layout_width="?attr/resultIconSize"
android:layout_height="?attr/resultIconSize"
style="@style/ResultItemIcon"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/icon_margin_left"
android:layout_marginLeft="@dimen/icon_margin_left"
android:layout_marginTop="@dimen/icon_margin_top"
android:layout_marginEnd="@dimen/icon_margin_right"
android:layout_marginRight="@dimen/icon_margin_right"
android:layout_marginBottom="@dimen/icon_margin_bottom"
android:importantForAccessibility="no"
android:src="@drawable/ic_contact"
tools:ignore="ContentDescription" />
Expand All @@ -49,7 +34,7 @@
android:textColor="?attr/resultColor"
android:textDirection="locale"
android:textSize="?attr/resultTitleSize"
tools:ignore="RtlSymmetry"
tools:ignore="RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_contact" />

<TextView
Expand All @@ -69,7 +54,7 @@
android:textColor="?android:attr/textColorSecondary"
android:textDirection="locale"
android:textSize="?attr/resultSubtitleSize"
tools:ignore="RtlSymmetry"
tools:ignore="RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_contact_phone" />

<TextView
Expand All @@ -94,7 +79,7 @@
android:textColor="?android:attr/textColorSecondary"
android:textDirection="locale"
android:textSize="?attr/resultSubtitleSize"
tools:ignore="RtlSymmetry"
tools:ignore="RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_contact_nickname" />

<ImageButton
Expand Down
22 changes: 4 additions & 18 deletions app/src/main/res/layout/item_phone.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
style="@style/ResultItem"
android:orientation="horizontal"
android:paddingBottom="@dimen/result_margin_bottom"
android:paddingEnd="@dimen/result_margin_right"
android:paddingLeft="@dimen/result_margin_left"
android:paddingRight="@dimen/result_margin_right"
android:paddingStart="@dimen/result_margin_left"
android:paddingTop="@dimen/result_margin_top"
tools:ignore="UseCompoundDrawables">

<ImageView
android:id="@+id/item_phone_icon"
android:layout_width="?attr/resultIconSize"
android:layout_height="?attr/resultIconSize"
android:layout_marginBottom="@dimen/icon_margin_bottom"
android:layout_marginEnd="@dimen/icon_margin_right"
android:layout_marginLeft="@dimen/icon_margin_left"
android:layout_marginRight="@dimen/icon_margin_right"
android:layout_marginStart="@dimen/icon_margin_left"
android:layout_marginTop="@dimen/icon_margin_top"
style="@style/ResultItemIcon"
android:contentDescription="@null"
android:src="@drawable/call" />

Expand All @@ -37,6 +22,7 @@
android:text="@string/stub_phone"
android:textColor="?attr/resultColor"
android:textDirection="locale"
android:textSize="?attr/resultTitleSize" />
android:textSize="?attr/resultTitleSize"
tools:ignore="UnusedAttribute" />

</LinearLayout>
22 changes: 4 additions & 18 deletions app/src/main/res/layout/item_search.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
style="@style/ResultItem"
android:orientation="horizontal"
android:paddingStart="@dimen/result_margin_left"
android:paddingLeft="@dimen/result_margin_left"
android:paddingTop="@dimen/result_margin_top"
android:paddingEnd="@dimen/result_margin_right"
android:paddingRight="@dimen/result_margin_right"
android:paddingBottom="@dimen/result_margin_bottom"
tools:ignore="UseCompoundDrawables">

<ImageView
android:id="@+id/item_search_icon"
android:layout_width="?attr/resultIconSize"
android:layout_height="?attr/resultIconSize"
android:layout_marginStart="@dimen/icon_margin_left"
android:layout_marginLeft="@dimen/icon_margin_left"
android:layout_marginTop="@dimen/icon_margin_top"
android:layout_marginEnd="@dimen/icon_margin_right"
android:layout_marginRight="@dimen/icon_margin_right"
android:layout_marginBottom="@dimen/icon_margin_bottom"
style="@style/ResultItemIcon"
android:contentDescription="@null"
android:src="@drawable/search" />

Expand All @@ -37,6 +22,7 @@
android:textColor="?attr/resultColor"
android:textDirection="locale"
android:textSize="?attr/resultTitleSize"
tools:text="@string/ui_item_search" />
tools:text="@string/ui_item_search"
tools:ignore="UnusedAttribute" />

</LinearLayout>
26 changes: 6 additions & 20 deletions app/src/main/res/layout/item_setting.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/result_margin_left"
android:paddingLeft="@dimen/result_margin_left"
android:paddingTop="@dimen/result_margin_top"
android:paddingEnd="@dimen/result_margin_right"
android:paddingRight="@dimen/result_margin_right"
android:paddingBottom="@dimen/result_margin_bottom">
style="@style/ResultItem"
android:orientation="horizontal">

<ImageView
android:id="@+id/item_setting_icon"
android:layout_width="?attr/resultIconSize"
android:layout_height="?attr/resultIconSize"
android:layout_marginStart="@dimen/icon_margin_left"
android:layout_marginLeft="@dimen/icon_margin_left"
android:layout_marginTop="@dimen/icon_margin_top"
android:layout_marginEnd="@dimen/icon_margin_right"
android:layout_marginRight="@dimen/icon_margin_right"
android:layout_marginBottom="@dimen/icon_margin_bottom"
style="@style/ResultItemIcon"
android:contentDescription="@null"
android:scaleType="centerInside"
tools:src="@android:drawable/ic_menu_manage" />
Expand All @@ -38,7 +23,8 @@
android:text="@string/settings_prefix"
android:textColor="?android:attr/textColorSecondary"
android:textDirection="locale"
android:textSize="?attr/resultSubtitleSize" />
android:textSize="?attr/resultSubtitleSize"
tools:ignore="UnusedAttribute" />

<TextView
android:id="@+id/item_setting_name"
Expand All @@ -56,7 +42,7 @@
android:textColor="?attr/resultColor"
android:textDirection="locale"
android:textSize="?attr/resultTitleSize"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:ignore="RtlHardcoded,RtlSymmetry,UnusedAttribute"
tools:text="@string/stub_setting" />

</LinearLayout>
Loading

0 comments on commit bbb9070

Please sign in to comment.