Subversion Repositories SmartDukaan

Rev

Rev 16310 | Rev 17066 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16310 Rev 16453
Line 442... Line 442...
442
        listParent.add(new ExpandableNavigationItem(getString(R.string.About_Us)));
442
        listParent.add(new ExpandableNavigationItem(getString(R.string.About_Us)));
443
 
443
 
444
        listDataChild.put(getString(R.string.Deals), new ArrayList<String>());
444
        listDataChild.put(getString(R.string.Deals), new ArrayList<String>());
445
        listDataChild.put(getString(R.string.Search), new ArrayList<String>());
445
        listDataChild.put(getString(R.string.Search), new ArrayList<String>());
446
 
446
 
447
        listDataChild.put(getString(R.string.Stores), Arrays.asList(mPlanetTitles));
-
 
448
        /*listDataChild.put(getString(R.string.Help), Arrays.asList(mHelpTitle));*/
447
        /*listDataChild.put(getString(R.string.Help), Arrays.asList(mHelpTitle));*/
449
 
-
 
-
 
448
        listDataChild.put(getString(R.string.Stores), Arrays.asList(mPlanetTitles));
450
        listDataChild.put(getString(R.string.Contact_Us), new ArrayList<String>());
449
        listDataChild.put(getString(R.string.Contact_Us), new ArrayList<String>());
451
        listDataChild.put(getString(R.string.Tutorials), new ArrayList<String>());
450
        listDataChild.put(getString(R.string.Tutorials), new ArrayList<String>());
452
        listDataChild.put(getString(R.string.About_Us), new ArrayList<String>());
451
        listDataChild.put(getString(R.string.About_Us), new ArrayList<String>());
453
 
452
 
454
        customAdapter = new ExpandableNavigationAdapter(this, listParent, listDataChild);
453
        customAdapter = new ExpandableNavigationAdapter(this, listParent, listDataChild);
Line 461... Line 460...
461
 
460
 
462
        // enable ActionBar app icon to behave as action to toggle nav drawer
461
        // enable ActionBar app icon to behave as action to toggle nav drawer
463
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
462
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
464
        getSupportActionBar().setHomeButtonEnabled(true);
463
        getSupportActionBar().setHomeButtonEnabled(true);
465
        //mDrawerList.setOnItemClickListener(new ExpandableListViewClick());
464
        //mDrawerList.setOnItemClickListener(new ExpandableListViewClick());
466
        mDrawerList.setOnGroupClickListener(new ExpandableListViewGroupClick());
465
        //mDrawerList.setOnGroupClickListener(new ExpandableListViewGroupClick());
467
        mDrawerList.setOnChildClickListener(new ExpandableListViewChildClick());
466
        mDrawerList.setOnChildClickListener(new ExpandableListViewChildClick());
468
 
-
 
-
 
467
        mDrawerList.setOnGroupExpandListener(new ExpandableGroupExpandListener());
469
        mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
468
        mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
470
                mDrawerLayout, /* DrawerLayout object */
469
                mDrawerLayout, /* DrawerLayout object */
471
                R.drawable.menubutton, /* nav drawer image to replace 'Up' caret */
470
                R.drawable.menu_button_2, /* nav drawer image to replace 'Up' caret */
472
                R.string.drawer_open, /* "open drawer" description for accessibility */
471
                R.string.drawer_open, /* "open drawer" description for accessibility */
473
                R.string.drawer_close /* "close drawer" description for accessibility */
472
                R.string.drawer_close /* "close drawer" description for accessibility */
474
        ) {
473
        ) {
475
            public void onDrawerClosed(View view) {
474
            public void onDrawerClosed(View view) {
476
                if(titleVisible!=0) {
475
                if(titleVisible!=0) {
Line 556... Line 555...
556
        }
555
        }
557
 
556
 
558
 
557
 
559
    }
558
    }
560
 
559
 
561
    /**
-
 
562
     * Slide menu item click listener
-
 
563
     * */
-
 
564
/*
-
 
565
    private class SlideMenuClickListener implements
560
    private class ExpandableGroupExpandListener implements ExpandableListView.OnGroupExpandListener{
566
            ListView.OnItemClickListener {
-
 
567
        @Override
561
        @Override
568
        public void onItemClick(AdapterView<?> parent, View view, int position,
562
        public void onGroupExpand(int groupPosition) {
569
                                long id) {
-
 
570
            // display view for selected nav drawer item
563
            int len = customAdapter.getGroupCount();
571
            displayView(position);
-
 
572
        }
-
 
573
    }
-
 
574
*/
-
 
575
 
564
 
576
    private class ExpandableListViewGroupClick implements ExpandableListView.OnGroupClickListener {
-
 
577
 
-
 
578
        @Override
-
 
579
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
-
 
580
            int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForGroup(groupPosition));
565
            int index = mDrawerList.getFlatListPosition(ExpandableListView.getPackedPositionForGroup(groupPosition));
581
            parent.setItemChecked(index, true);
566
            mDrawerList.setItemChecked(index, true);
582
            String parentTitle = ((ExpandableNavigationItem) customAdapter.getGroup(groupPosition)).getTitle();
567
            String parentTitle = ((ExpandableNavigationItem) customAdapter.getGroup(groupPosition)).getTitle();
583
            Log.d("Parent Title","Parent Title" + parentTitle);
568
            Log.d("Group Pos in child View", "" + groupPosition);
584
            if (!(parentTitle.equalsIgnoreCase(getString(R.string.Stores)))) {
569
            if(!(parentTitle.equalsIgnoreCase(getString(R.string.Stores)))) {
585
                Log.d("Parent Title","In if condition" + parentTitle);
-
 
586
                mDrawerLayout.closeDrawer(navDrawerView);
570
                mDrawerLayout.closeDrawer(navDrawerView);
587
                mDrawerList.collapseGroup(2);
571
                mDrawerList.collapseGroup(2);
588
            }
572
            }
589
            if(groupPosition!=2){
573
            if(groupPosition!=2){
590
                displayView(groupPosition);
574
                displayView(groupPosition);
591
            }
575
            }
592
            setActionBarTitlte(parentTitle);
576
            setActionBarTitlte(parentTitle);
593
            return false;
-
 
594
 
577
 
-
 
578
            for (int i = 0; i < len; i++) {
-
 
579
                if(i!=2) {
-
 
580
                    mDrawerList.collapseGroup(i);
-
 
581
                }
-
 
582
            }
595
        }
583
        }
596
    }
584
    }
597
    private class ExpandableListViewChildClick implements ExpandableListView.OnChildClickListener {
-
 
598
 
585
 
599
 
586
 
-
 
587
 
-
 
588
 
-
 
589
    private class ExpandableListViewChildClick implements ExpandableListView.OnChildClickListener {
600
        @Override
590
        @Override
601
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
591
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
602
            int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
592
            int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
603
            parent.setItemChecked(index, true);
593
            parent.setItemChecked(index, true);
604
            Log.d("Child Pos", "" + childPosition);
-
 
605
            mDrawerLayout.closeDrawer(navDrawerView);
594
            mDrawerLayout.closeDrawer(navDrawerView);
606
            displayChildView(childPosition);
595
            displayChildView(childPosition);
607
            return false;
596
            return false;
608
        }
597
        }
609
    }
598
    }
Line 1062... Line 1051...
1062
                args.putString("key", apiData.getString("affiliate.url.redirect","")+"?user_id="+userData.getString("id","")+"&store_id="+UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,spice=4,shopclues=5,")),ProfitTillConstants.FLIPKART));
1051
                args.putString("key", apiData.getString("affiliate.url.redirect","")+"?user_id="+userData.getString("id","")+"&store_id="+UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,spice=4,shopclues=5,")),ProfitTillConstants.FLIPKART));
1063
                fragment = new DealsHomeFragment();
1052
                fragment = new DealsHomeFragment();
1064
                fragment.setArguments(args);
1053
                fragment.setArguments(args);
1065
                break;
1054
                break;
1066
            case 2:
1055
            case 2:
-
 
1056
                t.send(new HitBuilders.EventBuilder()
-
 
1057
                        .setCategory("Menu")
-
 
1058
                        .setAction("Paytm ")
-
 
1059
                        .setLabel("Paytm Clicked")
-
 
1060
                        .build());
-
 
1061
 
-
 
1062
                new Analytics(ProfitTillConstants.ANALYTICS_URL,
-
 
1063
                        AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Paytm","Paytm Clicked"),
-
 
1064
                        AnalyticsJsonResponse.getAnalyticsRequestInstance(),
-
 
1065
                        AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
-
 
1066
                args.putString("key", apiData.getString("affiliate.url.redirect","")+"?user_id="+userData.getString("id","")+"&store_id="+UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,spice=4,shopclues=5,")),ProfitTillConstants.PAYTM));
-
 
1067
                //args.putString("key","https://paytm.com");
-
 
1068
                fragment = new DealsHomeFragment();
-
 
1069
                fragment.setArguments(args);
-
 
1070
                break;
-
 
1071
            case 3:
1067
                JSONObject propsSaholic = new JSONObject();
1072
                JSONObject propsSaholic = new JSONObject();
1068
                try {
1073
                try {
1069
                    mixpanel.identify(userData.getString("id",null));
1074
                    mixpanel.identify(userData.getString("id",null));
1070
                    propsSaholic.put("Screen", "Saholic");
1075
                    propsSaholic.put("Screen", "Saholic");
1071
                    mixpanel.track("Saholic", propsSaholic);
1076
                    mixpanel.track("Saholic", propsSaholic);
Line 1083... Line 1088...
1083
                        AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
1088
                        AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
1084
                args.putString("key", apiData.getString("saholic.autologin.url","")+"?user_id="+userData.getString("id",""));
1089
                args.putString("key", apiData.getString("saholic.autologin.url","")+"?user_id="+userData.getString("id",""));
1085
                fragment = new DealsHomeFragment();
1090
                fragment = new DealsHomeFragment();
1086
                fragment.setArguments(args);
1091
                fragment.setArguments(args);
1087
                break;
1092
                break;
1088
            case 3:
1093
            case 4:
1089
                JSONObject propsShopclues = new JSONObject();
1094
                JSONObject propsShopclues = new JSONObject();
1090
                try {
1095
                try {
1091
                    mixpanel.identify(userData.getString("id",null));
1096
                    mixpanel.identify(userData.getString("id",null));
1092
                    propsShopclues.put("Screen", "Shopclues");
1097
                    propsShopclues.put("Screen", "Shopclues");
1093
                    mixpanel.track("Shopclues", propsShopclues);
1098
                    mixpanel.track("Shopclues", propsShopclues);
Line 1113... Line 1118...
1113
                    cookieManager1.setCookie(url, "shopcluesActive=true");
1118
                    cookieManager1.setCookie(url, "shopcluesActive=true");
1114
                }
1119
                }
1115
                fragment = new DealsHomeFragment();
1120
                fragment = new DealsHomeFragment();
1116
                fragment.setArguments(args);
1121
                fragment.setArguments(args);
1117
                break;
1122
                break;
1118
            case 4:
1123
            case 5:
1119
                JSONObject propsSnapdeal = new JSONObject();
1124
                JSONObject propsSnapdeal = new JSONObject();
1120
                try {
1125
                try {
1121
                    mixpanel.identify(userData.getString("id",null));
1126
                    mixpanel.identify(userData.getString("id",null));
1122
                    propsSnapdeal.put("Screen", "Snapdeal");
1127
                    propsSnapdeal.put("Screen", "Snapdeal");
1123
                    mixpanel.track("Snapdeal", propsSnapdeal);
1128
                    mixpanel.track("Snapdeal", propsSnapdeal);
Line 1155... Line 1160...
1155
            getSupportActionBar().setCustomView(R.layout.actionbardeals);
1160
            getSupportActionBar().setCustomView(R.layout.actionbardeals);
1156
        }
1161
        }
1157
        if (parentTitle.equalsIgnoreCase("Visit Other Stores")) {
1162
        if (parentTitle.equalsIgnoreCase("Visit Other Stores")) {
1158
            getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
1163
            getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
1159
        }
1164
        }
1160
        if (parentTitle.equals("About Us")) {
1165
        if (parentTitle.equals("FAQ")) {
1161
            getSupportActionBar().setCustomView(R.layout.actionbaraboutus);
1166
            getSupportActionBar().setCustomView(R.layout.actionbaraboutus);
1162
        }
1167
        }
1163
        if (parentTitle.equals("Contact Us")) {
1168
        if (parentTitle.equals("Contact Us")) {
1164
            getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
1169
            getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
1165
        }
1170
        }