mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Made Drawer usable.
This commit is contained in:
parent
1ac52e6cfd
commit
7b31d25846
@ -196,7 +196,7 @@ public class MainActivity extends AppCompatActivity implements
|
||||
//Get action id
|
||||
int id = item.getItemId();
|
||||
|
||||
//To go backward
|
||||
//To toggle drawer
|
||||
if (id == android.R.id.home) {
|
||||
toggleDrawer();
|
||||
return true;
|
||||
@ -208,17 +208,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
return true;
|
||||
}
|
||||
|
||||
//To display the personal page of the user
|
||||
if (id == R.id.action_open_user_page) {
|
||||
openUserPage(AccountUtils.getID(MainActivity.this));
|
||||
return true;
|
||||
}
|
||||
|
||||
//To display the list of friends
|
||||
if (id == R.id.action_friends_list) {
|
||||
openFriendsFragment();
|
||||
return true;
|
||||
}
|
||||
|
||||
//To open settings fragment
|
||||
if (id == R.id.action_settings) {
|
||||
@ -251,6 +240,7 @@ public class MainActivity extends AppCompatActivity implements
|
||||
*/
|
||||
void init_drawer() {
|
||||
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mDrawer = findViewById(R.id.drawer_layout);
|
||||
@ -274,7 +264,36 @@ public class MainActivity extends AppCompatActivity implements
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
return false;
|
||||
int id = menuItem.getItemId();
|
||||
|
||||
//Notification fragment
|
||||
if(id == R.id.action_notifications){
|
||||
openNotificationsFragment();
|
||||
}
|
||||
|
||||
//Friends list
|
||||
else if(id == R.id.action_friendslist){
|
||||
openFriendsFragment();
|
||||
}
|
||||
|
||||
//User personal page
|
||||
else if(id == R.id.action_personal_page){
|
||||
openUserPage(new AccountUtils(this).get_current_user_id());
|
||||
}
|
||||
|
||||
//Latest posts
|
||||
else if(id == R.id.action_latest_posts){
|
||||
openLatestPostsFragment();
|
||||
}
|
||||
|
||||
//Conversations fragment
|
||||
else if(id == R.id.action_conversations) {
|
||||
openConversationsListFragment();
|
||||
}
|
||||
|
||||
|
||||
mDrawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@ import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
@ -304,9 +303,8 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
//Update the bottom navigation menu
|
||||
((MainActivity) getActivity())
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_conversations);
|
||||
.setSelectedNavigationItem(R.id.action_conversations);
|
||||
|
||||
((MainActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
//Check for conversation information
|
||||
if(conversationInfo == null){
|
||||
@ -337,7 +335,6 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
refreshRunnable.quitSafely();
|
||||
|
||||
((MainActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +156,7 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
||||
|
||||
//Update the bottom navigation menu
|
||||
((MainActivity) getActivity())
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_conversations);
|
||||
.setSelectedNavigationItem(R.id.action_conversations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ public class FriendsListFragment extends Fragment
|
||||
//Update the bottom navigation menu
|
||||
((MainActivity) getActivity())
|
||||
//.setSelectedNavigationItem(R.id.main_bottom_navigation_friends_list);
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_me_view);
|
||||
.setSelectedNavigationItem(R.id.action_latest_posts);
|
||||
|
||||
//Refresh the friends list
|
||||
refresh_friend_list();
|
||||
|
@ -112,7 +112,7 @@ public class LatestPostsFragment extends Fragment
|
||||
|
||||
//Update the bottom navigation menu
|
||||
((MainActivity) getActivity())
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_me_view);
|
||||
.setSelectedNavigationItem(R.id.action_latest_posts);
|
||||
|
||||
//Refresh the list of posts of the user
|
||||
refresh_posts_list();
|
||||
|
@ -3,7 +3,6 @@ package org.communiquons.android.comunic.client.ui.fragments;
|
||||
import android.app.AlertDialog;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@ -141,7 +140,7 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont
|
||||
|
||||
//Update the bottom navigation menu
|
||||
((MainActivity) getActivity())
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_notif);
|
||||
.setSelectedNavigationItem(R.id.action_notifications);
|
||||
|
||||
//Get user page opener
|
||||
mUserPageOpener = (onOpenUsersPageListener) getActivity();
|
||||
|
@ -232,7 +232,7 @@ public class UpdateConversationFragment extends Fragment {
|
||||
|
||||
//Update title and dock
|
||||
((MainActivity) getActivity()).setSelectedNavigationItem(
|
||||
R.id.main_bottom_navigation_conversations);
|
||||
R.id.action_conversations);
|
||||
|
||||
//Set the adapted title
|
||||
if(current_action == ACTION_CREATE_CONVERSATION)
|
||||
|
@ -153,7 +153,7 @@ public class UserAccessDeniedFragment extends Fragment implements View.OnClickLi
|
||||
|
||||
//Update activity dock
|
||||
((MainActivity) getActivity())
|
||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_me_view);
|
||||
.setSelectedNavigationItem(R.id.action_latest_posts);
|
||||
|
||||
//Check if it is required to fetch user information
|
||||
if(mUserInfo == null){
|
||||
|
@ -7,7 +7,6 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -178,7 +177,7 @@ public class UserPageFragment extends Fragment {
|
||||
|
||||
//Update activity menu dock
|
||||
((MainActivity) getActivity()).setSelectedNavigationItem(
|
||||
R.id.main_bottom_navigation_me_view);
|
||||
R.id.action_latest_posts);
|
||||
|
||||
//Initialize view pager
|
||||
FragmentPagerBaseAdapter adapter = new FragmentPagerBaseAdapter(getChildFragmentManager());
|
||||
|
9
app/src/main/res/drawable/ic_sync_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_sync_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-0.25 1.97,-0.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z" />
|
||||
</vector>
|
@ -2,32 +2,28 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/main_bottom_navigation_notif"
|
||||
android:id="@+id/action_notifications"
|
||||
android:title="@string/navigation_bottom_notif_item"
|
||||
android:icon="@drawable/ic_notif"/>
|
||||
android:icon="@drawable/ic_notif" />
|
||||
|
||||
<item
|
||||
android:id="@+id/main_bottom_navigation_friends_list"
|
||||
android:id="@+id/action_friendslist"
|
||||
android:title="@string/navigation_bottom_friends_item"
|
||||
android:icon="@drawable/ic_menu_allfriends"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/main_bottom_navigation_users_view"
|
||||
android:title="@string/navigation_bottom_user_item"
|
||||
android:icon="@drawable/perm_group_personal_info"
|
||||
android:visible="false" />
|
||||
android:id="@+id/action_personal_page"
|
||||
android:title="@string/action_personal_page"
|
||||
android:icon="@drawable/perm_group_personal_info" />
|
||||
|
||||
<item
|
||||
android:id="@+id/main_bottom_navigation_me_view"
|
||||
android:title="@string/navigation_bottom_user_item"
|
||||
android:icon="@drawable/perm_group_personal_info"
|
||||
/> <!--android:icon="@drawable/ic_menu_home"
|
||||
android:title="@string/navigation_bottom_me_item"-->
|
||||
android:id="@+id/action_latest_posts"
|
||||
android:title="@string/action_latest_posts"
|
||||
android:icon="@drawable/ic_sync_black_24dp" />
|
||||
|
||||
<item
|
||||
android:id="@+id/main_bottom_navigation_conversations"
|
||||
android:id="@+id/action_conversations"
|
||||
android:title="@string/navigation_bottom_conversations_item"
|
||||
android:icon="@drawable/ic_menu_conversations"
|
||||
/>
|
||||
android:icon="@drawable/ic_menu_conversations" />
|
||||
</menu>
|
@ -7,16 +7,6 @@
|
||||
android:id="@+id/action_search_user"
|
||||
android:title="@string/main_menu_search_user"/>
|
||||
|
||||
<!-- Open user page -->
|
||||
<item
|
||||
android:id="@+id/action_open_user_page"
|
||||
android:title="@string/main_menu_personal_page"/>
|
||||
|
||||
<!-- Display friends list -->
|
||||
<item
|
||||
android:id="@+id/action_friends_list"
|
||||
android:title="@string/main_menu_friends_list" />
|
||||
|
||||
<!-- Settings -->
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
|
@ -121,7 +121,7 @@
|
||||
<string name="like_view_liking">J\'aime</string>
|
||||
<string name="main_menu_friends_list">Liste d\'amis</string>
|
||||
<string name="navigation_bottom_notif_item">Notifications</string>
|
||||
<string name="navigation_bottom_user_item">Utilisateur</string>
|
||||
<string name="action_latest_posts">Fil d\'actualité</string>
|
||||
<string name="new_comment_hint">Nouveau commentaire</string>
|
||||
<string name="new_post_hint">Nouveau post…</string>
|
||||
<string name="popup_deletecomment_cancel">Non</string>
|
||||
|
@ -95,7 +95,7 @@
|
||||
<string name="action_friends_start_private_conversation">Private conversation</string>
|
||||
<string name="err_get_private_conversation">Could not get a private conversation !</string>
|
||||
<string name="dialog_loading_msg">Loading…</string>
|
||||
<string name="navigation_bottom_user_item">User</string>
|
||||
<string name="action_latest_posts">Latest posts</string>
|
||||
<string name="err_get_user_posts">Couldn\'t get user posts !</string>
|
||||
<string name="post_visibility_public">public</string>
|
||||
<string name="post_visibility_friends">friends</string>
|
||||
@ -199,4 +199,5 @@
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="action_personal_page">My Page</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user