Skip to content

Commit

Permalink
proper padding for double digit notifications, updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AKiniyalocts committed May 31, 2016
1 parent 3613c00 commit 776135c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ font)
}
dependencies {
compile 'com.github.Batterii:Minor:v1.1'
compile 'com.github.Batterii:Minor:v1.2'
}
```
##Usage
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion library/src/main/java/com/akiniyalocts/minor/MinorView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onClick(View v) {
}
});

home.addNotifcation(8);
home.addNotifcation(87);

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

Expand Down

0 comments on commit 776135c

Please sign in to comment.