diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBar.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBar.java
index a68aa41..886e1d2 100644
--- a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBar.java
+++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBar.java
@@ -69,7 +69,7 @@ public class NavigationBar extends BaseFrameLayoutView implements NavigationBarI
private void init(){
//Inflate main view
- View view = inflate(getContext(), R.layout.navigation_bar, this);
+ View view = inflate(getContext(), R.layout.view_navigation_bar, this);
mLinearLayout = view.findViewById(R.id.container);
//Inflate menu
diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBarItem.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBarItem.java
index 3fdeaff..b518b44 100644
--- a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBarItem.java
+++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/NavigationBarItem.java
@@ -1,11 +1,13 @@
package org.communiquons.android.comunic.client.ui.views;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;
+import android.widget.TextView;
import org.communiquons.android.comunic.client.R;
import org.communiquons.android.comunic.client.ui.utils.DrawableUtils;
@@ -16,13 +18,18 @@ import org.communiquons.android.comunic.client.ui.utils.UiUtils;
*
* @author Pierre HUBERT
*/
-class NavigationBarItem extends BaseFrameLayoutView implements View.OnClickListener {
+public class NavigationBarItem extends BaseFrameLayoutView implements View.OnClickListener {
/**
* Debug tag
*/
private static final String TAG = NavigationBarItem.class.getCanonicalName();
+ /**
+ * News number icon
+ */
+ private TextView mNumberNews;
+
/**
* Image icon
*/
@@ -48,13 +55,27 @@ class NavigationBarItem extends BaseFrameLayoutView implements View.OnClickListe
*/
private boolean mSelected;
- public NavigationBarItem(@NonNull Context context) {
+ NavigationBarItem(@NonNull Context context) {
super(context);
//Inflate view
- View view = inflate(getContext(), R.layout.navigation_bar_item, this);
+ View view = inflate(getContext(), R.layout.view_navigation_bar_item, this);
mIcon = view.findViewById(R.id.icon);
+ mNumberNews = view.findViewById(R.id.numberNews);
view.setOnClickListener(this);
+
+ setNumberNews(0);
+ }
+
+ /**
+ * Set the number of news
+ *
+ * @param number The number of news to display
+ */
+ @SuppressLint("SetTextI18n")
+ public void setNumberNews(Integer number){
+ mNumberNews.setText(""+number);
+ mNumberNews.setVisibility(number == 0 ? View.GONE : View.VISIBLE);
}
/**
diff --git a/app/src/main/res/drawable/ic_circle.xml b/app/src/main/res/drawable/ic_circle.xml
new file mode 100644
index 0000000..b5a886f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_circle.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/navigation_bar.xml b/app/src/main/res/layout/view_navigation_bar.xml
similarity index 100%
rename from app/src/main/res/layout/navigation_bar.xml
rename to app/src/main/res/layout/view_navigation_bar.xml
diff --git a/app/src/main/res/layout/navigation_bar_item.xml b/app/src/main/res/layout/view_navigation_bar_item.xml
similarity index 64%
rename from app/src/main/res/layout/navigation_bar_item.xml
rename to app/src/main/res/layout/view_navigation_bar_item.xml
index bb8fa70..643f477 100644
--- a/app/src/main/res/layout/navigation_bar_item.xml
+++ b/app/src/main/res/layout/view_navigation_bar_item.xml
@@ -20,4 +20,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
+
\ No newline at end of file