| Line 9... |
Line 9... |
| 9 |
import android.content.res.Configuration;
|
9 |
import android.content.res.Configuration;
|
| 10 |
import android.content.res.TypedArray;
|
10 |
import android.content.res.TypedArray;
|
| 11 |
import android.graphics.Color;
|
11 |
import android.graphics.Color;
|
| 12 |
import android.graphics.drawable.ColorDrawable;
|
12 |
import android.graphics.drawable.ColorDrawable;
|
| 13 |
import android.net.ConnectivityManager;
|
13 |
import android.net.ConnectivityManager;
|
| - |
|
14 |
import android.net.Uri;
|
| 14 |
import android.os.AsyncTask;
|
15 |
import android.os.AsyncTask;
|
| 15 |
import android.os.Bundle;
|
16 |
import android.os.Bundle;
|
| 16 |
import android.os.PersistableBundle;
|
17 |
import android.os.PersistableBundle;
|
| 17 |
import android.support.v4.app.ActionBarDrawerToggle;
|
18 |
import android.support.v4.app.ActionBarDrawerToggle;
|
| 18 |
import android.support.v4.widget.DrawerLayout;
|
19 |
import android.support.v4.widget.DrawerLayout;
|
| Line 22... |
Line 23... |
| 22 |
import android.view.Menu;
|
23 |
import android.view.Menu;
|
| 23 |
import android.view.MenuItem;
|
24 |
import android.view.MenuItem;
|
| 24 |
import android.view.View;
|
25 |
import android.view.View;
|
| 25 |
import android.view.ViewConfiguration;
|
26 |
import android.view.ViewConfiguration;
|
| 26 |
import android.view.Window;
|
27 |
import android.view.Window;
|
| - |
|
28 |
import android.webkit.CookieManager;
|
| - |
|
29 |
import android.webkit.CookieSyncManager;
|
| 27 |
import android.widget.AdapterView;
|
30 |
import android.widget.ExpandableListView;
|
| 28 |
import android.widget.ListView;
|
31 |
import android.widget.LinearLayout;
|
| 29 |
import android.widget.Toast;
|
32 |
import android.widget.Toast;
|
| 30 |
|
33 |
|
| 31 |
import com.facebook.Session;
|
34 |
import com.facebook.Session;
|
| 32 |
import com.google.android.gms.analytics.HitBuilders;
|
35 |
import com.google.android.gms.analytics.HitBuilders;
|
| 33 |
import com.google.android.gms.analytics.Tracker;
|
36 |
import com.google.android.gms.analytics.Tracker;
|
| Line 40... |
Line 43... |
| 40 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
43 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
| 41 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
44 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| 42 |
import com.saholic.profittill.Volley.Analytics;
|
45 |
import com.saholic.profittill.Volley.Analytics;
|
| 43 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
46 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
| 44 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
47 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
| - |
|
48 |
import com.saholic.profittill.navigationdrawer.ExpandableNavigationAdapter;
|
| - |
|
49 |
import com.saholic.profittill.navigationdrawer.ExpandableNavigationItem;
|
| 45 |
import com.saholic.profittill.navigationdrawer.NavDrawerItem;
|
50 |
import com.saholic.profittill.navigationdrawer.NavDrawerItem;
|
| 46 |
import com.saholic.profittill.navigationdrawer.NavDrawerListAdapter;
|
51 |
import com.saholic.profittill.navigationdrawer.NavDrawerListAdapter;
|
| 47 |
import com.testin.agent.TestinAgent;
|
52 |
import com.testin.agent.TestinAgent;
|
| 48 |
|
53 |
|
| 49 |
import org.apache.http.HttpEntity;
|
54 |
import org.apache.http.HttpEntity;
|
| Line 59... |
Line 64... |
| 59 |
|
64 |
|
| 60 |
import java.lang.reflect.Field;
|
65 |
import java.lang.reflect.Field;
|
| 61 |
import java.lang.reflect.Method;
|
66 |
import java.lang.reflect.Method;
|
| 62 |
import java.text.SimpleDateFormat;
|
67 |
import java.text.SimpleDateFormat;
|
| 63 |
import java.util.ArrayList;
|
68 |
import java.util.ArrayList;
|
| - |
|
69 |
import java.util.Arrays;
|
| 64 |
import java.util.Date;
|
70 |
import java.util.Date;
|
| - |
|
71 |
import java.util.HashMap;
|
| - |
|
72 |
import java.util.List;
|
| - |
|
73 |
import java.util.Map;
|
| 65 |
|
74 |
|
| 66 |
|
75 |
|
| 67 |
public class MainActivity extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
76 |
public class MainActivity extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
| 68 |
private DrawerLayout mDrawerLayout;
|
77 |
/*private DrawerLayout mDrawerLayout;
|
| 69 |
private ListView mDrawerList;
|
78 |
private ListView mDrawerList;
|
| 70 |
private ActionBarDrawerToggle mDrawerToggle;
|
79 |
private ActionBarDrawerToggle mDrawerToggle;*/
|
| 71 |
public GoogleApiClient mGoogleApiClient;
|
80 |
public GoogleApiClient mGoogleApiClient;
|
| 72 |
SharedPreferences userData;
|
81 |
SharedPreferences userData;
|
| 73 |
SharedPreferences apiData;
|
82 |
SharedPreferences apiData;
|
| 74 |
boolean glogout;
|
83 |
boolean glogout;
|
| 75 |
SharedPreferences.Editor userDataEditor;
|
84 |
SharedPreferences.Editor userDataEditor;
|
| Line 91... |
Line 100... |
| 91 |
SimpleDateFormat dateFormatAffliate;
|
100 |
SimpleDateFormat dateFormatAffliate;
|
| 92 |
String redirectUrl;
|
101 |
String redirectUrl;
|
| 93 |
MixpanelAPI mixpanel;
|
102 |
MixpanelAPI mixpanel;
|
| 94 |
String notificationURL;
|
103 |
String notificationURL;
|
| 95 |
ArrayList<NameValuePair> nameValuePairsGcm;
|
104 |
ArrayList<NameValuePair> nameValuePairsGcm;
|
| - |
|
105 |
|
| - |
|
106 |
|
| - |
|
107 |
private DrawerLayout mDrawerLayout;
|
| - |
|
108 |
private ExpandableListView mDrawerList;
|
| - |
|
109 |
private LinearLayout navDrawerView;
|
| - |
|
110 |
ExpandableNavigationAdapter customAdapter;
|
| - |
|
111 |
private ActionBarDrawerToggle mDrawerToggle;
|
| - |
|
112 |
private CharSequence mDrawerTitle;
|
| - |
|
113 |
private CharSequence mTitle;
|
| - |
|
114 |
private String[] mPlanetTitles;
|
| - |
|
115 |
private String[] mHelpTitle;
|
| - |
|
116 |
private int selectedPosition;
|
| - |
|
117 |
List<ExpandableNavigationItem> listParent;
|
| - |
|
118 |
HashMap<String, List<String>> listDataChild;
|
| - |
|
119 |
|
| - |
|
120 |
|
| 96 |
@Override
|
121 |
@Override
|
| 97 |
protected void onCreate(Bundle savedInstanceState) {
|
122 |
protected void onCreate(Bundle savedInstanceState) {
|
| 98 |
super.onCreate(savedInstanceState);
|
123 |
super.onCreate(savedInstanceState);
|
| 99 |
setContentView(R.layout.activity_main);
|
124 |
setContentView(R.layout.activity_main);
|
| 100 |
TestinAgent.init(this);
|
125 |
TestinAgent.init(this);
|
| Line 114... |
Line 139... |
| 114 |
t.send(new HitBuilders.EventBuilder()
|
139 |
t.send(new HitBuilders.EventBuilder()
|
| 115 |
.setCategory("Notification")
|
140 |
.setCategory("Notification")
|
| 116 |
.setAction("Notification Opened ")
|
141 |
.setAction("Notification Opened ")
|
| 117 |
.setLabel("For User Id " + userData.getString("id","0"))
|
142 |
.setLabel("For User Id " + userData.getString("id","0"))
|
| 118 |
.build());
|
143 |
.build());
|
| - |
|
144 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
145 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Notification","Notification Opened",getIntent().getExtras().getString("cid")),
|
| - |
|
146 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
147 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 119 |
flag=20;
|
148 |
flag=20;
|
| 120 |
notificationURL = String.valueOf(getIntent().getData());
|
149 |
notificationURL = String.valueOf(getIntent().getData());
|
| 121 |
nameValuePairsGcm = new ArrayList<>();
|
150 |
nameValuePairsGcm = new ArrayList<>();
|
| 122 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
151 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
| 123 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
152 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| Line 132... |
Line 161... |
| 132 |
.setCategory("Notification")
|
161 |
.setCategory("Notification")
|
| 133 |
.setAction("Notification Opened ")
|
162 |
.setAction("Notification Opened ")
|
| 134 |
.setLabel("For User Id " + userData.getString("id","0"))
|
163 |
.setLabel("For User Id " + userData.getString("id","0"))
|
| 135 |
.build());
|
164 |
.build());
|
| 136 |
flag=15;
|
165 |
flag=15;
|
| - |
|
166 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
167 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Notification","Notification Opened",getIntent().getExtras().getString("cid")),
|
| - |
|
168 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
169 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 137 |
nameValuePairsGcm = new ArrayList<>();
|
170 |
nameValuePairsGcm = new ArrayList<>();
|
| 138 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
171 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
| 139 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
172 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 140 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
173 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| 141 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
174 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
| Line 147... |
Line 180... |
| 147 |
t.send(new HitBuilders.EventBuilder()
|
180 |
t.send(new HitBuilders.EventBuilder()
|
| 148 |
.setCategory("Notification")
|
181 |
.setCategory("Notification")
|
| 149 |
.setAction("Notification Opened ")
|
182 |
.setAction("Notification Opened ")
|
| 150 |
.setLabel("For User Id " + userData.getString("id","0"))
|
183 |
.setLabel("For User Id " + userData.getString("id","0"))
|
| 151 |
.build());
|
184 |
.build());
|
| - |
|
185 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
186 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Notification","Notification Opened",getIntent().getExtras().getString("cid")),
|
| - |
|
187 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
188 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 152 |
flag=7;
|
189 |
flag=7;
|
| 153 |
nameValuePairsGcm = new ArrayList<>();
|
190 |
nameValuePairsGcm = new ArrayList<>();
|
| 154 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
191 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
| 155 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
192 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 156 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
193 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| Line 163... |
Line 200... |
| 163 |
t.send(new HitBuilders.EventBuilder()
|
200 |
t.send(new HitBuilders.EventBuilder()
|
| 164 |
.setCategory("Notification")
|
201 |
.setCategory("Notification")
|
| 165 |
.setAction("Notification Opened ")
|
202 |
.setAction("Notification Opened ")
|
| 166 |
.setLabel("For User Id " + userData.getString("id","0"))
|
203 |
.setLabel("For User Id " + userData.getString("id","0"))
|
| 167 |
.build());
|
204 |
.build());
|
| - |
|
205 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
206 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Notification","Notification Opened",getIntent().getExtras().getString("cid")),
|
| - |
|
207 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
208 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 168 |
flag=6;
|
209 |
flag=6;
|
| 169 |
nameValuePairsGcm = new ArrayList<>();
|
210 |
nameValuePairsGcm = new ArrayList<>();
|
| 170 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
211 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id","")));
|
| 171 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
212 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 172 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
213 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| Line 179... |
Line 220... |
| 179 |
t.send(new HitBuilders.EventBuilder()
|
220 |
t.send(new HitBuilders.EventBuilder()
|
| 180 |
.setCategory("Email Url Opener")
|
221 |
.setCategory("Email Url Opener")
|
| 181 |
.setAction("Email Url Opened ")
|
222 |
.setAction("Email Url Opened ")
|
| 182 |
.setLabel("For User Id " + userData.getString("id","0"))
|
223 |
.setLabel("For User Id " + userData.getString("id","0"))
|
| 183 |
.build());
|
224 |
.build());
|
| - |
|
225 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
226 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Notification","Notification Opened",getIntent().getExtras().getString("cid")),
|
| - |
|
227 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
228 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 184 |
flag=20;
|
229 |
flag=20;
|
| 185 |
String emailURL= String.valueOf(getIntent().getData());
|
230 |
String emailURL= String.valueOf(getIntent().getData());
|
| 186 |
notificationURL =new UtilityFunctions().getEmailUrlFromMap(getApplicationContext(), emailURL,apiData.getString("mobile.website.url",""))+"?user_id="+userData.getString("id","");
|
231 |
notificationURL =new UtilityFunctions().getEmailUrlFromMap(getApplicationContext(), emailURL,apiData.getString("mobile.website.url",""))+"?user_id="+userData.getString("id","");
|
| 187 |
}else {
|
232 |
}else {
|
| 188 |
Bundle i = getIntent().getExtras();
|
233 |
Bundle i = getIntent().getExtras();
|
| Line 192... |
Line 237... |
| 192 |
redirectUrl = i.getString("redirectUrl");
|
237 |
redirectUrl = i.getString("redirectUrl");
|
| 193 |
}
|
238 |
}
|
| 194 |
}
|
239 |
}
|
| 195 |
}
|
240 |
}
|
| 196 |
|
241 |
|
| 197 |
|
- |
|
| 198 |
|
- |
|
| 199 |
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
242 |
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
| 200 |
getSupportActionBar().setIcon(R.drawable.logo_cirlce_1);
|
243 |
getSupportActionBar().setIcon(R.drawable.logo_cirlce_1);
|
| 201 |
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
244 |
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
| 202 |
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
245 |
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
| 203 |
|
246 |
|
| Line 219... |
Line 262... |
| 219 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
262 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
| 220 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
263 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
| 221 |
mGoogleApiClient.connect();
|
264 |
mGoogleApiClient.connect();
|
| 222 |
}
|
265 |
}
|
| 223 |
|
266 |
|
| 224 |
/*mTitle = mDrawerTitle = getTitle();*/
|
267 |
/*mTitle = mDrawerTitle = getTitle();*//*
|
| 225 |
// load slide menu items
|
268 |
// load slide menu items
|
| 226 |
navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
|
269 |
navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
|
| 227 |
|
270 |
|
| 228 |
// nav drawer icons from resources
|
271 |
// nav drawer icons from resources
|
| 229 |
navMenuIcons = getResources()
|
272 |
navMenuIcons = getResources()
|
| Line 243... |
Line 286... |
| 243 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
|
286 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
|
| 244 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
|
287 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
|
| 245 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1)));
|
288 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1)));
|
| 246 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[7], navMenuIcons.getResourceId(7, -1)));
|
289 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[7], navMenuIcons.getResourceId(7, -1)));
|
| 247 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[8], navMenuIcons.getResourceId(8, -1)));
|
290 |
navDrawerItems.add(new NavDrawerItem(navMenuTitles[8], navMenuIcons.getResourceId(8, -1)));
|
| 248 |
/* navDrawerItems.add(new NavDrawerItem(navMenuTitles[9], navMenuIcons.getResourceId(9, -1)));*/
|
291 |
*//* navDrawerItems.add(new NavDrawerItem(navMenuTitles[9], navMenuIcons.getResourceId(9, -1)));*//*
|
| 249 |
navMenuIcons.recycle();
|
292 |
navMenuIcons.recycle();
|
| 250 |
|
293 |
|
| 251 |
mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
|
294 |
mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
|
| 252 |
|
- |
|
| - |
|
295 |
ExpandableListViewClick
|
| 253 |
// setting the nav drawer list adapter
|
296 |
// setting the nav drawer list adapter
|
| 254 |
adapter = new NavDrawerListAdapter(getApplicationContext(),navDrawerItems);
|
297 |
adapter = new NavDrawerListAdapter(getApplicationContext(),navDrawerItems);
|
| 255 |
mDrawerList.setAdapter(adapter);
|
298 |
mDrawerList.setAdapter(adapter);
|
| 256 |
|
299 |
|
| 257 |
// enabling action bar app icon and behaving it as toggle button
|
300 |
// enabling action bar app icon and behaving it as toggle button
|
| Line 369... |
Line 412... |
| 369 |
}else {
|
412 |
}else {
|
| 370 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
413 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| 371 |
displayView(0);
|
414 |
displayView(0);
|
| 372 |
}
|
415 |
}
|
| 373 |
|
416 |
|
| - |
|
417 |
}*/
|
| - |
|
418 |
|
| - |
|
419 |
mTitle = mDrawerTitle = getTitle();
|
| - |
|
420 |
|
| - |
|
421 |
navDrawerView = (LinearLayout) findViewById(R.id.navDrawerView);
|
| - |
|
422 |
mPlanetTitles = getResources().getStringArray(R.array.stores_array);
|
| - |
|
423 |
|
| - |
|
424 |
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
| - |
|
425 |
// mDrawerList = (ListView) findViewById(R.id.left_drawer);
|
| - |
|
426 |
|
| - |
|
427 |
mDrawerList = (ExpandableListView) findViewById(R.id.nav_left_drawer);
|
| - |
|
428 |
|
| - |
|
429 |
// set a custom shadow that overlays the main content when the drawer
|
| - |
|
430 |
// opens
|
| - |
|
431 |
//mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
| - |
|
432 |
|
| - |
|
433 |
listParent = new ArrayList<ExpandableNavigationItem>();
|
| - |
|
434 |
listDataChild = new HashMap<String, List<String>>();
|
| - |
|
435 |
|
| - |
|
436 |
// Navigation Drawer of Flight starts
|
| - |
|
437 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Deals)));
|
| - |
|
438 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Search)));
|
| - |
|
439 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Stores)));
|
| - |
|
440 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Contact_Us)));
|
| - |
|
441 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Tutorials)));
|
| - |
|
442 |
listParent.add(new ExpandableNavigationItem(getString(R.string.About_Us)));
|
| - |
|
443 |
|
| - |
|
444 |
listDataChild.put(getString(R.string.Deals), new ArrayList<String>());
|
| - |
|
445 |
listDataChild.put(getString(R.string.Search), new ArrayList<String>());
|
| - |
|
446 |
|
| - |
|
447 |
listDataChild.put(getString(R.string.Stores), Arrays.asList(mPlanetTitles));
|
| - |
|
448 |
/*listDataChild.put(getString(R.string.Help), Arrays.asList(mHelpTitle));*/
|
| - |
|
449 |
|
| - |
|
450 |
listDataChild.put(getString(R.string.Contact_Us), new ArrayList<String>());
|
| - |
|
451 |
listDataChild.put(getString(R.string.Tutorials), new ArrayList<String>());
|
| - |
|
452 |
listDataChild.put(getString(R.string.About_Us), new ArrayList<String>());
|
| - |
|
453 |
|
| - |
|
454 |
customAdapter = new ExpandableNavigationAdapter(this, listParent, listDataChild);
|
| - |
|
455 |
// setting list adapter
|
| - |
|
456 |
mDrawerList.setAdapter(customAdapter);
|
| - |
|
457 |
mDrawerList.setChoiceMode(ExpandableListView.CHOICE_MODE_SINGLE);
|
| - |
|
458 |
// // set up the drawer's list view with items and click listener
|
| - |
|
459 |
// mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles));
|
| - |
|
460 |
// mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
|
| - |
|
461 |
|
| - |
|
462 |
// enable ActionBar app icon to behave as action to toggle nav drawer
|
| - |
|
463 |
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
| - |
|
464 |
getSupportActionBar().setHomeButtonEnabled(true);
|
| - |
|
465 |
//mDrawerList.setOnItemClickListener(new ExpandableListViewClick());
|
| - |
|
466 |
mDrawerList.setOnGroupClickListener(new ExpandableListViewGroupClick());
|
| - |
|
467 |
mDrawerList.setOnChildClickListener(new ExpandableListViewChildClick());
|
| - |
|
468 |
|
| - |
|
469 |
mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
|
| - |
|
470 |
mDrawerLayout, /* DrawerLayout object */
|
| - |
|
471 |
R.drawable.menubutton, /* nav drawer image to replace 'Up' caret */
|
| - |
|
472 |
R.string.drawer_open, /* "open drawer" description for accessibility */
|
| - |
|
473 |
R.string.drawer_close /* "close drawer" description for accessibility */
|
| - |
|
474 |
) {
|
| - |
|
475 |
public void onDrawerClosed(View view) {
|
| - |
|
476 |
if(titleVisible!=0) {
|
| - |
|
477 |
if(titleVisible==1)
|
| - |
|
478 |
getSupportActionBar().setCustomView(R.layout.actionbarmyfavorites);
|
| - |
|
479 |
|
| - |
|
480 |
if(titleVisible==2)
|
| - |
|
481 |
getSupportActionBar().setCustomView(R.layout.actionbarprefernces);
|
| - |
|
482 |
|
| - |
|
483 |
if(titleVisible==3)
|
| - |
|
484 |
getSupportActionBar().setCustomView(R.layout.actionbarmywallet);
|
| - |
|
485 |
|
| - |
|
486 |
if(titleVisible==4)
|
| - |
|
487 |
getSupportActionBar().setCustomView(R.layout.actionbarmyorders);
|
| - |
|
488 |
|
| - |
|
489 |
if(titleVisible==5)
|
| - |
|
490 |
getSupportActionBar().setCustomView(R.layout.actionbarpendingcashback);
|
| - |
|
491 |
|
| - |
|
492 |
if(titleVisible==6)
|
| - |
|
493 |
getSupportActionBar().setCustomView(R.layout.actionbarmyprofile);
|
| - |
|
494 |
}
|
| - |
|
495 |
shouldGoInvisible = false;
|
| - |
|
496 |
invalidateOptionsMenu();
|
| - |
|
497 |
}
|
| - |
|
498 |
|
| - |
|
499 |
public void onDrawerOpened(View drawerView) {
|
| - |
|
500 |
getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
|
| - |
|
501 |
shouldGoInvisible = true;
|
| - |
|
502 |
invalidateOptionsMenu();
|
| - |
|
503 |
}
|
| - |
|
504 |
};
|
| - |
|
505 |
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
| - |
|
506 |
|
| - |
|
507 |
|
| - |
|
508 |
if (savedInstanceState == null) {
|
| - |
|
509 |
|
| - |
|
510 |
if (flag == 7) {
|
| - |
|
511 |
getSupportActionBar().setCustomView(R.layout.actionbarhowitworks);
|
| - |
|
512 |
displayView(4);
|
| - |
|
513 |
} else if (flag == 6) {
|
| - |
|
514 |
getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
|
| - |
|
515 |
displayView(3);
|
| - |
|
516 |
} else if (flag == 15) {
|
| - |
|
517 |
getSupportActionBar().setCustomView(R.layout.actionbarmyprofile);
|
| - |
|
518 |
MyProfile myProfile = new MyProfile();
|
| - |
|
519 |
this.getFragmentManager().beginTransaction()
|
| - |
|
520 |
.replace(R.id.frame_container, myProfile, "Mike")
|
| - |
|
521 |
.addToBackStack(null)
|
| - |
|
522 |
.commit();
|
| - |
|
523 |
}else if (flag == 20) {
|
| - |
|
524 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| - |
|
525 |
JSONObject propsNotification = new JSONObject();
|
| - |
|
526 |
try {
|
| - |
|
527 |
mixpanel.identify(userData.getString("id",null));
|
| - |
|
528 |
propsNotification.put("Screen", "Notification Url opened");
|
| - |
|
529 |
mixpanel.track("Notification Opened", propsNotification);
|
| - |
|
530 |
} catch (JSONException e) {
|
| - |
|
531 |
e.printStackTrace();
|
| - |
|
532 |
}
|
| - |
|
533 |
Bundle args = new Bundle();
|
| - |
|
534 |
DealsHomeFragment notifcationFragment = new DealsHomeFragment();
|
| - |
|
535 |
args.putString("key", notificationURL);
|
| - |
|
536 |
this.getFragmentManager().beginTransaction()
|
| - |
|
537 |
.replace(R.id.frame_container, notifcationFragment, "Mike")
|
| - |
|
538 |
.addToBackStack(null)
|
| - |
|
539 |
.commit();
|
| - |
|
540 |
notifcationFragment.setArguments(args);
|
| - |
|
541 |
}else if (flag == 31) {
|
| - |
|
542 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| - |
|
543 |
Bundle args = new Bundle();
|
| - |
|
544 |
DealsHomeFragment redirectUrlFragment = new DealsHomeFragment();
|
| - |
|
545 |
args.putString("key", redirectUrl);
|
| - |
|
546 |
this.getFragmentManager().beginTransaction()
|
| - |
|
547 |
.replace(R.id.frame_container, redirectUrlFragment, "Mike")
|
| - |
|
548 |
.addToBackStack(null)
|
| - |
|
549 |
.commit();
|
| - |
|
550 |
redirectUrlFragment.setArguments(args);
|
| - |
|
551 |
}else {
|
| - |
|
552 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| - |
|
553 |
displayView(0);
|
| - |
|
554 |
}
|
| - |
|
555 |
|
| 374 |
}
|
556 |
}
|
| - |
|
557 |
|
| - |
|
558 |
|
| 375 |
}
|
559 |
}
|
| 376 |
|
560 |
|
| 377 |
/**
|
561 |
/**
|
| 378 |
* Slide menu item click listener
|
562 |
* Slide menu item click listener
|
| 379 |
* */
|
563 |
* */
|
| - |
|
564 |
/*
|
| 380 |
private class SlideMenuClickListener implements
|
565 |
private class SlideMenuClickListener implements
|
| 381 |
ListView.OnItemClickListener {
|
566 |
ListView.OnItemClickListener {
|
| 382 |
@Override
|
567 |
@Override
|
| 383 |
public void onItemClick(AdapterView<?> parent, View view, int position,
|
568 |
public void onItemClick(AdapterView<?> parent, View view, int position,
|
| 384 |
long id) {
|
569 |
long id) {
|
| 385 |
// display view for selected nav drawer item
|
570 |
// display view for selected nav drawer item
|
| 386 |
displayView(position);
|
571 |
displayView(position);
|
| 387 |
}
|
572 |
}
|
| 388 |
}
|
573 |
}
|
| - |
|
574 |
*/
|
| - |
|
575 |
|
| - |
|
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));
|
| - |
|
581 |
parent.setItemChecked(index, true);
|
| - |
|
582 |
String parentTitle = ((ExpandableNavigationItem) customAdapter.getGroup(groupPosition)).getTitle();
|
| - |
|
583 |
Log.d("Parent Title","Parent Title" + parentTitle);
|
| - |
|
584 |
if (!(parentTitle.equalsIgnoreCase(getString(R.string.Stores)))) {
|
| - |
|
585 |
Log.d("Parent Title","In if condition" + parentTitle);
|
| - |
|
586 |
mDrawerLayout.closeDrawer(navDrawerView);
|
| - |
|
587 |
mDrawerList.collapseGroup(2);
|
| - |
|
588 |
}
|
| - |
|
589 |
if(groupPosition!=2){
|
| - |
|
590 |
displayView(groupPosition);
|
| - |
|
591 |
}
|
| - |
|
592 |
setActionBarTitlte(parentTitle);
|
| - |
|
593 |
return false;
|
| - |
|
594 |
|
| - |
|
595 |
}
|
| - |
|
596 |
}
|
| - |
|
597 |
private class ExpandableListViewChildClick implements ExpandableListView.OnChildClickListener {
|
| - |
|
598 |
|
| 389 |
|
599 |
|
| - |
|
600 |
@Override
|
| - |
|
601 |
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
| - |
|
602 |
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
|
| - |
|
603 |
parent.setItemChecked(index, true);
|
| - |
|
604 |
Log.d("Child Pos", "" + childPosition);
|
| - |
|
605 |
mDrawerLayout.closeDrawer(navDrawerView);
|
| - |
|
606 |
displayChildView(childPosition);
|
| - |
|
607 |
return false;
|
| - |
|
608 |
}
|
| - |
|
609 |
}
|
| 390 |
@Override
|
610 |
@Override
|
| 391 |
public boolean onCreateOptionsMenu(Menu menu) {
|
611 |
public boolean onCreateOptionsMenu(Menu menu) {
|
| 392 |
mainMenu=menu;
|
612 |
mainMenu=menu;
|
| 393 |
super.onCreateOptionsMenu(menu);
|
613 |
super.onCreateOptionsMenu(menu);
|
| 394 |
getMenuInflater().inflate(R.menu.menu_main, menu);
|
614 |
getMenuInflater().inflate(R.menu.menu_main, menu);
|
| Line 706... |
Line 926... |
| 706 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
926 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 707 |
args.putString("key", apiData.getString("search.url",null)+"?user_id="+id);
|
927 |
args.putString("key", apiData.getString("search.url",null)+"?user_id="+id);
|
| 708 |
fragment = new DealsHomeFragment();
|
928 |
fragment = new DealsHomeFragment();
|
| 709 |
fragment.setArguments(args);
|
929 |
fragment.setArguments(args);
|
| 710 |
break;
|
930 |
break;
|
| - |
|
931 |
case 3:
|
| - |
|
932 |
JSONObject propsContactUs = new JSONObject();
|
| - |
|
933 |
try {
|
| - |
|
934 |
mixpanel.identify(userData.getString("id",null));
|
| - |
|
935 |
propsContactUs.put("Screen", "Contact Us");
|
| - |
|
936 |
mixpanel.track("Contact Us", propsContactUs);
|
| - |
|
937 |
} catch (JSONException e) {
|
| - |
|
938 |
e.printStackTrace();
|
| - |
|
939 |
}
|
| - |
|
940 |
t.send(new HitBuilders.EventBuilder()
|
| - |
|
941 |
.setCategory("Menu")
|
| - |
|
942 |
.setAction("Contact Us ")
|
| - |
|
943 |
.setLabel("Contact us Clicked")
|
| - |
|
944 |
.build());
|
| - |
|
945 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
946 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Contact Us","Contact Us Clicked"),
|
| - |
|
947 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
948 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| - |
|
949 |
fragment = new ContactUsFragment();
|
| - |
|
950 |
break;
|
| - |
|
951 |
case 4:
|
| - |
|
952 |
JSONObject propsHowItWorks = new JSONObject();
|
| - |
|
953 |
try {
|
| - |
|
954 |
mixpanel.identify(userData.getString("id",null));
|
| - |
|
955 |
propsHowItWorks.put("Screen", "How it Works");
|
| - |
|
956 |
mixpanel.track("How it Works", propsHowItWorks);
|
| - |
|
957 |
} catch (JSONException e) {
|
| - |
|
958 |
e.printStackTrace();
|
| - |
|
959 |
}
|
| - |
|
960 |
t.send(new HitBuilders.EventBuilder()
|
| - |
|
961 |
.setCategory("Menu")
|
| - |
|
962 |
.setAction("Tutorials ")
|
| - |
|
963 |
.setLabel("Tutorials Clicked")
|
| - |
|
964 |
.build());
|
| - |
|
965 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
966 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","How it Works","How it works Clicked"),
|
| - |
|
967 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
968 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| - |
|
969 |
fragment = new HowItWorksFragment();
|
| - |
|
970 |
break;
|
| - |
|
971 |
case 5:
|
| - |
|
972 |
JSONObject propsAboutUs = new JSONObject();
|
| - |
|
973 |
try {
|
| - |
|
974 |
mixpanel.identify(userData.getString("id",null));
|
| - |
|
975 |
propsAboutUs.put("Screen", "About Us");
|
| - |
|
976 |
mixpanel.track("About Us", propsAboutUs);
|
| - |
|
977 |
} catch (JSONException e) {
|
| - |
|
978 |
e.printStackTrace();
|
| - |
|
979 |
}
|
| - |
|
980 |
t.send(new HitBuilders.EventBuilder()
|
| - |
|
981 |
.setCategory("Menu")
|
| - |
|
982 |
.setAction("About Us ")
|
| - |
|
983 |
.setLabel("About us Clicked")
|
| - |
|
984 |
.build());
|
| - |
|
985 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
986 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","About Us","About Us Clicked"),
|
| - |
|
987 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
988 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| - |
|
989 |
fragment = new AboutUsFragment();
|
| - |
|
990 |
break;
|
| - |
|
991 |
default:
|
| - |
|
992 |
break;
|
| - |
|
993 |
}
|
| - |
|
994 |
/* if (fragment != null) {
|
| - |
|
995 |
FragmentManager fragmentManager = getFragmentManager();
|
| - |
|
996 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
| - |
|
997 |
mDrawerList.setItemChecked(position, true);
|
| - |
|
998 |
mDrawerList.setSelection(position);
|
| - |
|
999 |
setTitle(navMenuTitles[position]);
|
| - |
|
1000 |
mDrawerLayout.closeDrawer(mDrawerList);
|
| - |
|
1001 |
}*/
|
| - |
|
1002 |
if (fragment != null) {
|
| - |
|
1003 |
FragmentManager fragmentManager = getFragmentManager();
|
| - |
|
1004 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
| - |
|
1005 |
|
| - |
|
1006 |
} else {
|
| - |
|
1007 |
Log.e("MainActivity", "Error in creating fragment");
|
| - |
|
1008 |
}
|
| - |
|
1009 |
}
|
| - |
|
1010 |
|
| - |
|
1011 |
|
| - |
|
1012 |
private void displayChildView(int position) {
|
| - |
|
1013 |
titleVisible=0;
|
| - |
|
1014 |
Bundle args = new Bundle();
|
| - |
|
1015 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| - |
|
1016 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| - |
|
1017 |
String id = userData.getString("id", null);
|
| - |
|
1018 |
Fragment fragment = null;
|
| - |
|
1019 |
Map<String, String> jsonParams;
|
| - |
|
1020 |
switch (position) {
|
| 711 |
case 2:
|
1021 |
case 0:
|
| 712 |
JSONObject propsAmazon = new JSONObject();
|
1022 |
JSONObject propsAmazon = new JSONObject();
|
| 713 |
try {
|
1023 |
try {
|
| 714 |
mixpanel.identify(userData.getString("id",null));
|
1024 |
mixpanel.identify(userData.getString("id",null));
|
| 715 |
propsAmazon.put("Screen", "Amazon");
|
1025 |
propsAmazon.put("Screen", "Amazon");
|
| 716 |
mixpanel.track("Amazon", propsAmazon);
|
1026 |
mixpanel.track("Amazon", propsAmazon);
|
| Line 728... |
Line 1038... |
| 728 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1038 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 729 |
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.AMAZON));
|
1039 |
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.AMAZON));
|
| 730 |
fragment = new DealsHomeFragment();
|
1040 |
fragment = new DealsHomeFragment();
|
| 731 |
fragment.setArguments(args);
|
1041 |
fragment.setArguments(args);
|
| 732 |
break;
|
1042 |
break;
|
| 733 |
case 3:
|
1043 |
case 1:
|
| 734 |
JSONObject propsFlipkart = new JSONObject();
|
1044 |
JSONObject propsFlipkart = new JSONObject();
|
| 735 |
try {
|
1045 |
try {
|
| 736 |
mixpanel.identify(userData.getString("id",null));
|
1046 |
mixpanel.identify(userData.getString("id",null));
|
| 737 |
propsFlipkart.put("Screen", "Flipkart");
|
1047 |
propsFlipkart.put("Screen", "Flipkart");
|
| 738 |
mixpanel.track("Flipkart", propsFlipkart);
|
1048 |
mixpanel.track("Flipkart", propsFlipkart);
|
| Line 751... |
Line 1061... |
| 751 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1061 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 752 |
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));
|
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));
|
| 753 |
fragment = new DealsHomeFragment();
|
1063 |
fragment = new DealsHomeFragment();
|
| 754 |
fragment.setArguments(args);
|
1064 |
fragment.setArguments(args);
|
| 755 |
break;
|
1065 |
break;
|
| 756 |
case 4:
|
1066 |
case 2:
|
| 757 |
JSONObject propsSaholic = new JSONObject();
|
1067 |
JSONObject propsSaholic = new JSONObject();
|
| 758 |
try {
|
1068 |
try {
|
| 759 |
mixpanel.identify(userData.getString("id",null));
|
1069 |
mixpanel.identify(userData.getString("id",null));
|
| 760 |
propsSaholic.put("Screen", "Saholic");
|
1070 |
propsSaholic.put("Screen", "Saholic");
|
| 761 |
mixpanel.track("Saholic", propsSaholic);
|
1071 |
mixpanel.track("Saholic", propsSaholic);
|
| Line 773... |
Line 1083... |
| 773 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1083 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 774 |
args.putString("key", apiData.getString("saholic.autologin.url","")+"?user_id="+userData.getString("id",""));
|
1084 |
args.putString("key", apiData.getString("saholic.autologin.url","")+"?user_id="+userData.getString("id",""));
|
| 775 |
fragment = new DealsHomeFragment();
|
1085 |
fragment = new DealsHomeFragment();
|
| 776 |
fragment.setArguments(args);
|
1086 |
fragment.setArguments(args);
|
| 777 |
break;
|
1087 |
break;
|
| 778 |
/*case 5:
|
1088 |
case 3:
|
| 779 |
JSONObject propsShopclues = new JSONObject();
|
1089 |
JSONObject propsShopclues = new JSONObject();
|
| 780 |
try {
|
1090 |
try {
|
| 781 |
mixpanel.identify(userData.getString("id",null));
|
1091 |
mixpanel.identify(userData.getString("id",null));
|
| 782 |
propsShopclues.put("Screen", "Shopclues");
|
1092 |
propsShopclues.put("Screen", "Shopclues");
|
| 783 |
mixpanel.track("Shopclues", propsShopclues);
|
1093 |
mixpanel.track("Shopclues", propsShopclues);
|
| Line 787... |
Line 1097... |
| 787 |
t.send(new HitBuilders.EventBuilder()
|
1097 |
t.send(new HitBuilders.EventBuilder()
|
| 788 |
.setCategory("Menu")
|
1098 |
.setCategory("Menu")
|
| 789 |
.setAction("Shopclues ")
|
1099 |
.setAction("Shopclues ")
|
| 790 |
.setLabel("Shopclues Clicked")
|
1100 |
.setLabel("Shopclues Clicked")
|
| 791 |
.build());
|
1101 |
.build());
|
| - |
|
1102 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| 792 |
//args.putString("key", apiData.getString("affiliate.url.redirect","")+"?user_id="+userData.getString("id","")+"&store_id="+apiData.getString("store.code.snapdeal",""));
|
1103 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Shopclues","Shopclues Clicked"),
|
| - |
|
1104 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
1105 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 793 |
String url=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,")),"shopclues");
|
1106 |
String url=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.SHOPCLUES);
|
| 794 |
args.putString("key", url);
|
1107 |
args.putString("key", url);
|
| - |
|
1108 |
if(Uri.parse(url).getHost().equalsIgnoreCase(ProfitTillConstants.DOMAIN)) {
|
| 795 |
CookieSyncManager.createInstance(getApplicationContext());
|
1109 |
CookieSyncManager.createInstance(getApplicationContext());
|
| 796 |
CookieManager cookieManager = CookieManager.getInstance();
|
1110 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
| 797 |
cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
|
1111 |
cookieManager1.setCookie(url, "token=" + userData.getString("token", ""));
|
| 798 |
cookieManager.setCookie(url, "walletAuthentication=true");
|
1112 |
cookieManager1.setCookie(url, "walletAuthentication=true");
|
| 799 |
cookieManager.setCookie(url, "shopcluesActive=true");
|
1113 |
cookieManager1.setCookie(url, "shopcluesActive=true");
|
| - |
|
1114 |
}
|
| 800 |
fragment = new DealsHomeFragment();
|
1115 |
fragment = new DealsHomeFragment();
|
| 801 |
fragment.setArguments(args);
|
1116 |
fragment.setArguments(args);
|
| 802 |
break;*/
|
1117 |
break;
|
| 803 |
case 5:
|
1118 |
case 4:
|
| 804 |
JSONObject propsSnapdeal = new JSONObject();
|
1119 |
JSONObject propsSnapdeal = new JSONObject();
|
| 805 |
try {
|
1120 |
try {
|
| 806 |
mixpanel.identify(userData.getString("id",null));
|
1121 |
mixpanel.identify(userData.getString("id",null));
|
| 807 |
propsSnapdeal.put("Screen", "Snapdeal");
|
1122 |
propsSnapdeal.put("Screen", "Snapdeal");
|
| 808 |
mixpanel.track("Snapdeal", propsSnapdeal);
|
1123 |
mixpanel.track("Snapdeal", propsSnapdeal);
|
| Line 816... |
Line 1131... |
| 816 |
.build());
|
1131 |
.build());
|
| 817 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
1132 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| 818 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Snapdeal","Snapdeal Clicked"),
|
1133 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Snapdeal","Snapdeal Clicked"),
|
| 819 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
1134 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| 820 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1135 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 821 |
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.SNAPDEAL));
|
1136 |
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.SNAPDEAL));
|
| 822 |
fragment = new DealsHomeFragment();
|
1137 |
fragment = new DealsHomeFragment();
|
| 823 |
fragment.setArguments(args);
|
1138 |
fragment.setArguments(args);
|
| 824 |
break;
|
1139 |
break;
|
| 825 |
case 6:
|
- |
|
| 826 |
JSONObject propsContactUs = new JSONObject();
|
- |
|
| 827 |
try {
|
- |
|
| 828 |
mixpanel.identify(userData.getString("id",null));
|
- |
|
| 829 |
propsContactUs.put("Screen", "Contact Us");
|
- |
|
| 830 |
mixpanel.track("Contact Us", propsContactUs);
|
- |
|
| 831 |
} catch (JSONException e) {
|
- |
|
| 832 |
e.printStackTrace();
|
- |
|
| 833 |
}
|
- |
|
| 834 |
t.send(new HitBuilders.EventBuilder()
|
- |
|
| 835 |
.setCategory("Menu")
|
- |
|
| 836 |
.setAction("Contact Us ")
|
- |
|
| 837 |
.setLabel("Contact us Clicked")
|
- |
|
| 838 |
.build());
|
- |
|
| 839 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
- |
|
| 840 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Contact Us","Contact Us Clicked"),
|
- |
|
| 841 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
- |
|
| 842 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
- |
|
| 843 |
fragment = new ContactUsFragment();
|
- |
|
| 844 |
break;
|
- |
|
| 845 |
case 7:
|
- |
|
| 846 |
JSONObject propsHowItWorks = new JSONObject();
|
- |
|
| 847 |
try {
|
- |
|
| 848 |
mixpanel.identify(userData.getString("id",null));
|
- |
|
| 849 |
propsHowItWorks.put("Screen", "How it Works");
|
- |
|
| 850 |
mixpanel.track("How it Works", propsHowItWorks);
|
- |
|
| 851 |
} catch (JSONException e) {
|
- |
|
| 852 |
e.printStackTrace();
|
- |
|
| 853 |
}
|
- |
|
| 854 |
t.send(new HitBuilders.EventBuilder()
|
- |
|
| 855 |
.setCategory("Menu")
|
- |
|
| 856 |
.setAction("Tutorials ")
|
- |
|
| 857 |
.setLabel("Tutorials Clicked")
|
- |
|
| 858 |
.build());
|
- |
|
| 859 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
- |
|
| 860 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","How it Works","How it works Clicked"),
|
- |
|
| 861 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
- |
|
| 862 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
- |
|
| 863 |
fragment = new HowItWorksFragment();
|
- |
|
| 864 |
break;
|
- |
|
| 865 |
case 8:
|
- |
|
| 866 |
JSONObject propsAboutUs = new JSONObject();
|
- |
|
| 867 |
try {
|
- |
|
| 868 |
mixpanel.identify(userData.getString("id",null));
|
- |
|
| 869 |
propsAboutUs.put("Screen", "About Us");
|
- |
|
| 870 |
mixpanel.track("About Us", propsAboutUs);
|
- |
|
| 871 |
} catch (JSONException e) {
|
- |
|
| 872 |
e.printStackTrace();
|
- |
|
| 873 |
}
|
- |
|
| 874 |
t.send(new HitBuilders.EventBuilder()
|
- |
|
| 875 |
.setCategory("Menu")
|
- |
|
| 876 |
.setAction("About Us ")
|
- |
|
| 877 |
.setLabel("About us Clicked")
|
- |
|
| 878 |
.build());
|
- |
|
| 879 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
- |
|
| 880 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","About Us","About Us Clicked"),
|
- |
|
| 881 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
- |
|
| 882 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
- |
|
| 883 |
fragment = new AboutUsFragment();
|
- |
|
| 884 |
break;
|
- |
|
| 885 |
default:
|
1140 |
default:
|
| 886 |
break;
|
1141 |
break;
|
| 887 |
}
|
1142 |
}
|
| 888 |
if (fragment != null) {
|
1143 |
if (fragment != null) {
|
| 889 |
FragmentManager fragmentManager = getFragmentManager();
|
1144 |
FragmentManager fragmentManager = getFragmentManager();
|
| 890 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
1145 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
| 891 |
mDrawerList.setItemChecked(position, true);
|
- |
|
| 892 |
mDrawerList.setSelection(position);
|
- |
|
| - |
|
1146 |
|
| 893 |
setTitle(navMenuTitles[position]);
|
1147 |
} else {
|
| 894 |
mDrawerLayout.closeDrawer(mDrawerList);
|
1148 |
Log.e("MainActivity", "Error in creating fragment");
|
| 895 |
}
|
1149 |
}
|
| 896 |
}
|
1150 |
}
|
| 897 |
|
1151 |
|
| 898 |
|
1152 |
|
| - |
|
1153 |
public void setActionBarTitlte(String parentTitle){
|
| - |
|
1154 |
if (parentTitle.equals("Deals")) {
|
| - |
|
1155 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| - |
|
1156 |
}
|
| - |
|
1157 |
if (parentTitle.equalsIgnoreCase("Visit Other Stores")) {
|
| - |
|
1158 |
getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
|
| - |
|
1159 |
}
|
| - |
|
1160 |
if (parentTitle.equals("About Us")) {
|
| - |
|
1161 |
getSupportActionBar().setCustomView(R.layout.actionbaraboutus);
|
| - |
|
1162 |
}
|
| - |
|
1163 |
if (parentTitle.equals("Contact Us")) {
|
| - |
|
1164 |
getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
|
| - |
|
1165 |
}
|
| - |
|
1166 |
if (parentTitle.equals("Search")) {
|
| - |
|
1167 |
getSupportActionBar().setCustomView(R.layout.actionbarsearch);
|
| - |
|
1168 |
}
|
| - |
|
1169 |
if (parentTitle.equals("How it Works")) {
|
| - |
|
1170 |
getSupportActionBar().setCustomView(R.layout.actionbarhowitworks);
|
| - |
|
1171 |
}
|
| - |
|
1172 |
}
|
| 899 |
|
1173 |
|
| 900 |
@Override
|
1174 |
@Override
|
| 901 |
protected void onPostCreate(Bundle savedInstanceState) {
|
1175 |
protected void onPostCreate(Bundle savedInstanceState) {
|
| 902 |
super.onPostCreate(savedInstanceState);
|
1176 |
super.onPostCreate(savedInstanceState);
|
| 903 |
mDrawerToggle.syncState();
|
1177 |
mDrawerToggle.syncState();
|