Skip to content

Commit 776135c

Browse files
committed
proper padding for double digit notifications, updated readme
1 parent 3613c00 commit 776135c

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ font)
2222
}
2323
2424
dependencies {
25-
compile 'com.github.Batterii:Minor:v1.1'
25+
compile 'com.github.Batterii:Minor:v1.2'
2626
}
2727
```
2828
##Usage
@@ -96,13 +96,16 @@ font)
9696
app:minor_title_text_color="@android:color/white" // text color for your unselected item
9797
app:minor_icon_view="@layout/minor_home"// the view (ImageView, Custom font TextView, etc.)
9898
// inflated as an icon for your item
99-
// REQUIRED!!!
99+
// REQUIRED!!!a
100100
```
101101

102102
####MinorLayout
103103
```xml
104104
app:minor_center_items="true" //items are weighted evenly, and centered in the layout
105105
android:background="@color/colorPrimary" // set the background color for your layout
106+
107+
app:layout_behavior="com.akiniyalocts.minor.behavior.MinorBehavior"//quick return scrolling behavior (similar to toolbar)
108+
106109
```
107110

108111
####Notifications

library/src/main/java/com/akiniyalocts/minor/MinorView.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,19 @@ public void addNotifcation(int notificationCount){
150150
TextView notificationTextView = (TextView) notificationView.findViewById(R.id.minor_notification_text);
151151

152152

153-
notificationTextView.setText(String.valueOf(notificationCount));
153+
if(notificationCount <= 99) {
154+
notificationTextView.setText(String.valueOf(notificationCount));
155+
}
156+
else {
157+
notificationTextView.setText("*");
158+
}
154159
LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT);
155160
params.setMargins(20,15,5,5);
161+
notificationView.setPadding(5, 5, 5, 5);
162+
156163
notificationView.setLayoutParams(params);
157164

165+
158166
this.addView(notificationView);
159167

160168
invalidate();

minorsample/src/main/java/com/akiniyalocts/minorsample/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void onClick(View v) {
4141
}
4242
});
4343

44-
home.addNotifcation(8);
44+
home.addNotifcation(87);
4545

4646
final MinorView lists = (MinorView)findViewById(R.id.lists);
4747

0 commit comments

Comments
 (0)