package in.testpress.testpress.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;

import in.testpress.testpress.R;

public class MainMenuFragment extends Fragment {

    GridView grid;
    String[] menuItemNames = {
            "My Exams",
            "Store",
            "Orders",
            "Notifications",
            "Logout"
    } ;
    int[] menuItemImageId = {
            R.drawable.exams,
            R.drawable.store,
            R.drawable.cart,
            R.drawable.posts,
            R.drawable.logout
    };

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.main_menu_grid_view, container, false);
    }

    @Override
    public void onViewCreated(final View view, final Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        MainMenuGridAdapter adapter = new MainMenuGridAdapter(getActivity(), menuItemNames, menuItemImageId);
        grid=(GridView)view.findViewById(R.id.grid);
        grid.setAdapter(adapter);
        grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                Intent intent;
                switch (position) {
                    case 0:
                        intent = new Intent(getActivity(), ExamsListActivity.class);
                        startActivity(intent);
                        break;
                    case 1:
                        intent = new Intent(getActivity(), ProductsListActivity.class);
                        startActivity(intent);
                        break;
                    case 2:
                        intent = new Intent(getActivity(), OrdersListActivity.class);
                        startActivity(intent);
                        break;
                    case 3:
                        intent = new Intent(getActivity(), PostsListActivity.class);
                        startActivity(intent);
                        break;
                    case 4:
                        ((MainActivity)getActivity()).logout();
                        break;
                }
            }
        });
    }
}

@@ -441,24 +441,26 @@
 %22My Exams%22,%0A
+//
             
@@ -468,16 +468,18 @@
 Store%22,%0A
+//
         
@@ -509,20 +509,12 @@
    %22
-Notification
+Post
 s%22,%0A
@@ -602,16 +602,18 @@
 .exams,%0A
+//
         
@@ -634,16 +634,18 @@
 .store,%0A
+//
         
@@ -1767,32 +1767,34 @@
          break;%0A
+//
                 
@@ -1805,16 +1805,18 @@
 case 1:%0A
+//
         
@@ -1887,32 +1887,34 @@
 ctivity.class);%0A
+//
                 
@@ -1936,32 +1936,34 @@
 tivity(intent);%0A
+//
                 
@@ -1969,32 +1969,34 @@
          break;%0A
+//
                 
@@ -2007,16 +2007,18 @@
 case 2:%0A
+//
         
@@ -2087,32 +2087,34 @@
 ctivity.class);%0A
+//
                 
@@ -2136,32 +2136,34 @@
 tivity(intent);%0A
+//
                 
@@ -2206,9 +2206,9 @@
 ase 
-3
+1
 :%0A  
@@ -2393,17 +2393,17 @@
    case 
-4
+2
 :%0A      

Remove products and orders from main menu temporarily