diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java
index a81e6a7..9afb0fb 100644
--- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java
+++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java
@@ -8,17 +8,13 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.design.widget.NavigationView;
import android.support.v4.app.FragmentTransaction;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
-import android.widget.TextView;
+import android.widget.PopupMenu;
import android.widget.Toast;
import org.communiquons.android.comunic.client.BuildConfig;
@@ -29,8 +25,6 @@ import org.communiquons.android.comunic.client.data.helpers.AccountHelper;
import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper;
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
import org.communiquons.android.comunic.client.data.helpers.DebugHelper;
-import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
-import org.communiquons.android.comunic.client.data.models.UserInfo;
import org.communiquons.android.comunic.client.data.runnables.FriendRefreshLoopRunnable;
import org.communiquons.android.comunic.client.data.services.NotificationsService;
import org.communiquons.android.comunic.client.data.utils.AccountUtils;
@@ -50,7 +44,6 @@ import org.communiquons.android.comunic.client.ui.listeners.openConversationList
import org.communiquons.android.comunic.client.ui.listeners.updateConversationListener;
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
import org.communiquons.android.comunic.client.ui.views.NavigationBar;
-import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
/**
@@ -178,7 +171,7 @@ public class MainActivity extends AppCompatActivity implements
/**
- * Top menu creation
+ * Activity context menu
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -230,6 +223,12 @@ public class MainActivity extends AppCompatActivity implements
+ /**
+ * Navigation bar options
+ *
+ * @param menuItem Selected item
+ * @return TRUE if the event is consumed / FALSE else
+ */
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
int id = menuItem.getItemId();
@@ -259,6 +258,25 @@ public class MainActivity extends AppCompatActivity implements
openConversationsListFragment();
}
+ //More options
+ else if(id == R.id.action_more){
+ PopupMenu popupMenu = new PopupMenu(this,
+ mNavBar.getItemIdentifierView(R.id.action_more));
+ onCreateOptionsMenu(popupMenu.getMenu());
+ popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ return onOptionsItemSelected(item);
+ }
+ });
+ popupMenu.show();
+ return false;
+ }
+
+ else
+ //Option not found
+ return false;
+
return true;
}
diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/utils/MenuUtils.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/utils/MenuUtils.java
new file mode 100644
index 0000000..90e500c
--- /dev/null
+++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/utils/MenuUtils.java
@@ -0,0 +1,29 @@
+package org.communiquons.android.comunic.client.ui.utils;
+
+import android.view.Menu;
+import android.view.MenuItem;
+
+/**
+ * Menu utilities
+ *
+ * @author Pierre HUBERT
+ */
+public class MenuUtils {
+
+ /**
+ * Find and return the index of an identifier in a menu
+ *
+ * @param menu Target menu
+ * @param identifier Queried identifier
+ * @return Matching index
+ */
+ public static int MenuIdentifierToIndex(Menu menu, int identifier){
+ MenuItem item = menu.findItem(identifier);
+
+ for(int i = 0; i < menu.size(); i++)
+ if(menu.getItem(i).equals(item))
+ return i;
+
+ throw new RuntimeException("Identifier not found in menu!");
+ }
+}
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 ca5e926..b5c7b85 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
@@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.PopupMenu;
import org.communiquons.android.comunic.client.R;
+import org.communiquons.android.comunic.client.ui.utils.MenuUtils;
import java.util.ArrayList;
@@ -110,6 +111,27 @@ public class NavigationBar extends BaseFrameLayoutView implements NavigationBarI
this.mOnNavigationItemSelectedListener = onNavigationItemSelectedListener;
}
+ /**
+ * Get the view associated to an index
+ *
+ * @param index The index of the item to get
+ * @return Related view
+ */
+ public View getItemIndexView(int index){
+ return mItems.get(index);
+ }
+
+ /**
+ * Get the view associated to an identifier
+ *
+ * @param id The identifier of the item to get
+ * @return Related view
+ */
+ public View getItemIdentifierView(int id){
+ return getItemIndexView(MenuUtils.MenuIdentifierToIndex(mMenu, id));
+ }
+
+
@Override
public void onItemClick(int index) {
if(mOnNavigationItemSelectedListener == null)
diff --git a/app/src/main/res/drawable/ic_more.xml b/app/src/main/res/drawable/ic_more.xml
new file mode 100644
index 0000000..82bdc37
--- /dev/null
+++ b/app/src/main/res/drawable/ic_more.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/menu/navigation_bar.xml b/app/src/main/res/menu/navigation_bar.xml
index 1fc3163..3c48294 100644
--- a/app/src/main/res/menu/navigation_bar.xml
+++ b/app/src/main/res/menu/navigation_bar.xml
@@ -26,4 +26,9 @@
android:id="@+id/action_conversations"
android:title="@string/navigation_bottom_conversations_item"
android:icon="@drawable/ic_menu_conversations" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 58812f8..ca07e96 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -236,4 +236,5 @@
Trop de tentative de connexion ont échouées. Veuillez réessayer ultérieurement.
Cette adresse est déjà associée à un compte Comunic existant !
Trop de création de compte. Veuillez réessayer ultérieurement.
+ Plus
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b135c44..1d518b5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -234,5 +234,6 @@
Sign in
Too many failed login requests. Please try again later…
This email address is already associated with an account!
- Too many account creation requests. Please try again later...
+ Too many account creation requests. Please try again later…
+ More