From 776135c646662fe84c900baf17459fd9f945e4d4 Mon Sep 17 00:00:00 2001 From: akiniyalocts Date: Tue, 31 May 2016 11:51:03 -0400 Subject: [PATCH] proper padding for double digit notifications, updated readme --- README.md | 7 +++++-- .../main/java/com/akiniyalocts/minor/MinorView.java | 10 +++++++++- .../com/akiniyalocts/minorsample/MainActivity.java | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a30cf62..83a6e88 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ font) } dependencies { - compile 'com.github.Batterii:Minor:v1.1' + compile 'com.github.Batterii:Minor:v1.2' } ``` ##Usage @@ -96,13 +96,16 @@ font) app:minor_title_text_color="@android:color/white" // text color for your unselected item app:minor_icon_view="@layout/minor_home"// the view (ImageView, Custom font TextView, etc.) // inflated as an icon for your item - // REQUIRED!!! + // REQUIRED!!!a ``` ####MinorLayout ```xml app:minor_center_items="true" //items are weighted evenly, and centered in the layout android:background="@color/colorPrimary" // set the background color for your layout + + app:layout_behavior="com.akiniyalocts.minor.behavior.MinorBehavior"//quick return scrolling behavior (similar to toolbar) + ``` ####Notifications diff --git a/library/src/main/java/com/akiniyalocts/minor/MinorView.java b/library/src/main/java/com/akiniyalocts/minor/MinorView.java index 8458d92..5f59868 100644 --- a/library/src/main/java/com/akiniyalocts/minor/MinorView.java +++ b/library/src/main/java/com/akiniyalocts/minor/MinorView.java @@ -150,11 +150,19 @@ public void addNotifcation(int notificationCount){ TextView notificationTextView = (TextView) notificationView.findViewById(R.id.minor_notification_text); - notificationTextView.setText(String.valueOf(notificationCount)); + if(notificationCount <= 99) { + notificationTextView.setText(String.valueOf(notificationCount)); + } + else { + notificationTextView.setText("*"); + } LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT); params.setMargins(20,15,5,5); + notificationView.setPadding(5, 5, 5, 5); + notificationView.setLayoutParams(params); + this.addView(notificationView); invalidate(); diff --git a/minorsample/src/main/java/com/akiniyalocts/minorsample/MainActivity.java b/minorsample/src/main/java/com/akiniyalocts/minorsample/MainActivity.java index 053e3da..4179da5 100644 --- a/minorsample/src/main/java/com/akiniyalocts/minorsample/MainActivity.java +++ b/minorsample/src/main/java/com/akiniyalocts/minorsample/MainActivity.java @@ -41,7 +41,7 @@ public void onClick(View v) { } }); - home.addNotifcation(8); + home.addNotifcation(87); final MinorView lists = (MinorView)findViewById(R.id.lists);