| Line 1... |
Line 1... |
| 1 |
package com.saholic.profittill.main;
|
1 |
package com.saholic.profittill.main;
|
| 2 |
import android.Manifest;
|
2 |
import android.Manifest;
|
| 3 |
import android.annotation.TargetApi;
|
3 |
import android.annotation.TargetApi;
|
| 4 |
import android.app.AlarmManager;
|
4 |
import android.app.AlarmManager;
|
| 5 |
import android.app.AlertDialog;
|
- |
|
| 6 |
import android.app.Fragment;
|
5 |
import android.app.Fragment;
|
| 7 |
import android.app.FragmentManager;
|
6 |
import android.app.FragmentManager;
|
| 8 |
import android.app.PendingIntent;
|
7 |
import android.app.PendingIntent;
|
| 9 |
import android.content.Context;
|
8 |
import android.content.Context;
|
| 10 |
import android.content.DialogInterface;
|
- |
|
| 11 |
import android.content.Intent;
|
9 |
import android.content.Intent;
|
| 12 |
import android.content.SharedPreferences;
|
10 |
import android.content.SharedPreferences;
|
| - |
|
11 |
import android.content.pm.ActivityInfo;
|
| 13 |
import android.content.pm.PackageManager;
|
12 |
import android.content.pm.PackageManager;
|
| 14 |
import android.content.res.Configuration;
|
13 |
import android.content.res.Configuration;
|
| 15 |
import android.graphics.Color;
|
14 |
import android.graphics.Color;
|
| 16 |
import android.graphics.PorterDuff;
|
15 |
import android.graphics.PorterDuff;
|
| 17 |
import android.graphics.drawable.ColorDrawable;
|
16 |
import android.graphics.drawable.ColorDrawable;
|
| Line 29... |
Line 28... |
| 29 |
import android.support.v4.widget.DrawerLayout;
|
28 |
import android.support.v4.widget.DrawerLayout;
|
| 30 |
import android.support.v7.app.ActionBarActivity;
|
29 |
import android.support.v7.app.ActionBarActivity;
|
| 31 |
import android.util.Log;
|
30 |
import android.util.Log;
|
| 32 |
import android.view.KeyEvent;
|
31 |
import android.view.KeyEvent;
|
| 33 |
import android.view.Menu;
|
32 |
import android.view.Menu;
|
| 34 |
import android.view.MenuItem;
|
33 |
import android.view.View;
|
| 35 |
import android.view.ViewConfiguration;
|
34 |
import android.view.ViewConfiguration;
|
| 36 |
import android.view.Window;
|
35 |
import android.view.Window;
|
| 37 |
import android.webkit.CookieManager;
|
36 |
import android.webkit.CookieManager;
|
| 38 |
import android.webkit.CookieSyncManager;
|
37 |
import android.webkit.CookieSyncManager;
|
| 39 |
import android.widget.ExpandableListView;
|
38 |
import android.widget.ExpandableListView;
|
| Line 116... |
Line 115... |
| 116 |
|
115 |
|
| 117 |
@Override
|
116 |
@Override
|
| 118 |
protected void onCreate(Bundle savedInstanceState) {
|
117 |
protected void onCreate(Bundle savedInstanceState) {
|
| 119 |
super.onCreate(savedInstanceState);
|
118 |
super.onCreate(savedInstanceState);
|
| 120 |
setContentView(R.layout.activity_main);
|
119 |
setContentView(R.layout.activity_main);
|
| - |
|
120 |
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
| 121 |
TestinAgent.init(this);
|
121 |
TestinAgent.init(this);
|
| 122 |
|
- |
|
| 123 |
getSupportActionBar().hide();
|
122 |
getSupportActionBar().hide();
|
| - |
|
123 |
int InstanceId = MainActivity.class.hashCode();
|
| 124 |
userData = getApplicationContext().getSharedPreferences("User_Data", MODE_PRIVATE);
|
124 |
userData = getApplicationContext().getSharedPreferences("User_Data", MODE_PRIVATE);
|
| 125 |
apiData = getApplicationContext().getSharedPreferences("API_Data", MODE_PRIVATE);
|
125 |
apiData = getApplicationContext().getSharedPreferences("API_Data", MODE_PRIVATE);
|
| 126 |
userDataEditor = userData.edit();
|
126 |
userDataEditor = userData.edit();
|
| 127 |
apiSettingsEditor = apiData.edit();
|
127 |
apiSettingsEditor = apiData.edit();
|
| 128 |
checkPermission();
|
128 |
checkPermission();
|
| Line 151... |
Line 151... |
| 151 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
151 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 152 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
152 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
| 153 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
153 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
| 154 |
getIntent().getExtras().remove("cid");
|
154 |
getIntent().getExtras().remove("cid");
|
| 155 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
155 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| - |
|
156 |
}
|
| 156 |
}else if(getIntent().getAction()=="15"){
|
157 |
else if(getIntent().getAction()=="15"){
|
| 157 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
158 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 158 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
159 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 159 |
t.send(new HitBuilders.EventBuilder()
|
160 |
t.send(new HitBuilders.EventBuilder()
|
| 160 |
.setCategory("Notification")
|
161 |
.setCategory("Notification")
|
| 161 |
.setAction("Notification Opened ")
|
162 |
.setAction("Notification Opened ")
|
| Line 171... |
Line 172... |
| 171 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
172 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 172 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
173 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| 173 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
174 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
| 174 |
getIntent().getExtras().remove("cid");
|
175 |
getIntent().getExtras().remove("cid");
|
| 175 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
176 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| - |
|
177 |
}
|
| 176 |
}else if(getIntent().getAction()=="7"){
|
178 |
else if(getIntent().getAction()=="7"){
|
| 177 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
179 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 178 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
180 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 179 |
t.send(new HitBuilders.EventBuilder()
|
181 |
t.send(new HitBuilders.EventBuilder()
|
| 180 |
.setCategory("Notification")
|
182 |
.setCategory("Notification")
|
| 181 |
.setAction("Notification Opened ")
|
183 |
.setAction("Notification Opened ")
|
| Line 191... |
Line 193... |
| 191 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
193 |
nameValuePairsGcm.add(new BasicNameValuePair("cid",getIntent().getExtras().getString("cid")));
|
| 192 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
194 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| 193 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
195 |
nameValuePairsGcm.add(new BasicNameValuePair("result","opened"));
|
| 194 |
getIntent().getExtras().remove("cid");
|
196 |
getIntent().getExtras().remove("cid");
|
| 195 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
197 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| - |
|
198 |
}
|
| 196 |
}else if(getIntent().getAction()=="6"){
|
199 |
else if(getIntent().getAction()=="6"){
|
| 197 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
200 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 198 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
201 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 199 |
t.send(new HitBuilders.EventBuilder()
|
202 |
t.send(new HitBuilders.EventBuilder()
|
| 200 |
.setCategory("Notification")
|
203 |
.setCategory("Notification")
|
| 201 |
.setAction("Notification Opened ")
|
204 |
.setAction("Notification Opened ")
|
| Line 240... |
Line 243... |
| 240 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
243 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp",UtilityFunctions.notificationDate()));
|
| 241 |
nameValuePairsGcm.add(new BasicNameValuePair("result","message_opened"));
|
244 |
nameValuePairsGcm.add(new BasicNameValuePair("result","message_opened"));
|
| 242 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
245 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| 243 |
flag=20;
|
246 |
flag=20;
|
| 244 |
notificationURL=urlOpen.replace("?user_id="+campaignUserId,"?user_id="+userData.getString("id",""));
|
247 |
notificationURL=urlOpen.replace("?user_id="+campaignUserId,"?user_id="+userData.getString("id",""));
|
| - |
|
248 |
}
|
| 245 |
}else if (url.getQueryParameter("intent_type").equalsIgnoreCase("native")){
|
249 |
else if (url.getQueryParameter("intent_type").equalsIgnoreCase("native")){
|
| 246 |
String campaignId = url.getQueryParameter("campaign");
|
250 |
String campaignId = url.getQueryParameter("campaign");
|
| 247 |
DESEncrypter desEncrypter = new DESEncrypter(ProfitTillConstants.AUTH_PASSWORD);
|
251 |
DESEncrypter desEncrypter = new DESEncrypter(ProfitTillConstants.AUTH_PASSWORD);
|
| 248 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
252 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 249 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
253 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 250 |
t.send(new HitBuilders.EventBuilder()
|
254 |
t.send(new HitBuilders.EventBuilder()
|
| Line 272... |
Line 276... |
| 272 |
flag=6;
|
276 |
flag=6;
|
| 273 |
}
|
277 |
}
|
| 274 |
else if(desEncrypter.decrypt(url.getQueryParameter("key")).equalsIgnoreCase("tutorial")){
|
278 |
else if(desEncrypter.decrypt(url.getQueryParameter("key")).equalsIgnoreCase("tutorial")){
|
| 275 |
flag=7;
|
279 |
flag=7;
|
| 276 |
}else{
|
280 |
}else{
|
| 277 |
String dealsUrl=apiData.getString("Web_Uri","http://pm.shop2020.in/entry-point");
|
281 |
String dealsUrl=apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point");
|
| 278 |
//String dealsUrl=ProfitTillConstants.Web_Uri;
|
282 |
//String dealsUrl=ProfitTillConstants.Web_Uri;
|
| 279 |
flag=20;
|
283 |
flag=20;
|
| 280 |
notificationURL =dealsUrl;
|
284 |
notificationURL =dealsUrl;
|
| 281 |
}
|
285 |
}
|
| 282 |
}else if (url.getQueryParameter("intent_type").equalsIgnoreCase("update")){
|
286 |
}else if (url.getQueryParameter("intent_type").equalsIgnoreCase("update")){
|
| Line 308... |
Line 312... |
| 308 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName()));
|
312 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName()));
|
| 309 |
}
|
313 |
}
|
| 310 |
startActivity(intent);
|
314 |
startActivity(intent);
|
| 311 |
}
|
315 |
}
|
| 312 |
else{
|
316 |
else{
|
| 313 |
String dealsUrl=apiData.getString("Web_Uri","http://pm.shop2020.in/entry-point");
|
317 |
String dealsUrl=apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point");
|
| 314 |
//String dealsUrl=ProfitTillConstants.Web_Uri;
|
318 |
//String dealsUrl=ProfitTillConstants.Web_Uri;
|
| 315 |
flag=20;
|
319 |
flag=20;
|
| 316 |
notificationURL =dealsUrl;
|
320 |
notificationURL =dealsUrl;
|
| 317 |
}
|
321 |
}
|
| 318 |
}
|
322 |
}
|
| Line 361... |
Line 365... |
| 361 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
365 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
| 362 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
366 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
| 363 |
mGoogleApiClient.connect();
|
367 |
mGoogleApiClient.connect();
|
| 364 |
}
|
368 |
}
|
| 365 |
|
369 |
|
| 366 |
mTitle = mDrawerTitle = getTitle();
|
370 |
/* mTitle = mDrawerTitle = getTitle();
|
| 367 |
|
371 |
|
| 368 |
/*navDrawerView = (LinearLayout) findViewById(R.id.navDrawerView);
|
372 |
navDrawerView = (LinearLayout) findViewById(R.id.navDrawerView);
|
| 369 |
mPlanetTitles = getResources().getStringArray(R.array.stores_array);
|
373 |
mPlanetTitles = getResources().getStringArray(R.array.stores_array);
|
| 370 |
mHelpTtiles= getResources().getStringArray(R.array.help_array);
|
374 |
mHelpTtiles= getResources().getStringArray(R.array.help_array);
|
| 371 |
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
375 |
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
| 372 |
mDrawerList = (ExpandableListView) findViewById(R.id.nav_left_drawer);*/
|
376 |
mDrawerList = (ExpandableListView) findViewById(R.id.nav_left_drawer);
|
| 373 |
/* if(userData.getString("registered","").equalsIgnoreCase("false")){
|
377 |
if(userData.getString("registered","").equalsIgnoreCase("false")){
|
| 374 |
getSupportActionBar().hide();
|
378 |
getSupportActionBar().hide();
|
| 375 |
mDrawerLayout.setVisibility(View.INVISIBLE);
|
379 |
mDrawerLayout.setVisibility(View.INVISIBLE);
|
| 376 |
|
380 |
|
| 377 |
}*/
|
381 |
}
|
| 378 |
/* listParent = new ArrayList<ExpandableNavigationItem>();
|
382 |
listParent = new ArrayList<ExpandableNavigationItem>();
|
| 379 |
listDataChild = new HashMap<String, List<String>>();
|
383 |
listDataChild = new HashMap<String, List<String>>();
|
| 380 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Deals)));
|
384 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Deals)));
|
| 381 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Search)));
|
385 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Search)));
|
| 382 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Stores)));
|
386 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Stores)));
|
| 383 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Help)));
|
387 |
listParent.add(new ExpandableNavigationItem(getString(R.string.Help)));
|
| Line 387... |
Line 391... |
| 387 |
listDataChild.put(getString(R.string.Help), Arrays.asList(mHelpTtiles));
|
391 |
listDataChild.put(getString(R.string.Help), Arrays.asList(mHelpTtiles));
|
| 388 |
|
392 |
|
| 389 |
customAdapter = new ExpandableNavigationAdapter(this, listParent, listDataChild);
|
393 |
customAdapter = new ExpandableNavigationAdapter(this, listParent, listDataChild);
|
| 390 |
|
394 |
|
| 391 |
mDrawerList.setAdapter(customAdapter);
|
395 |
mDrawerList.setAdapter(customAdapter);
|
| 392 |
mDrawerList.setChoiceMode(ExpandableListView.CHOICE_MODE_SINGLE);*/
|
396 |
mDrawerList.setChoiceMode(ExpandableListView.CHOICE_MODE_SINGLE);
|
| 393 |
|
397 |
|
| 394 |
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
398 |
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
| 395 |
//getSupportActionBar().setHomeButtonEnabled(true);
|
399 |
getSupportActionBar().setHomeButtonEnabled(true);
|
| 396 |
/* mDrawerList.setOnChildClickListener(new ExpandableListViewChildClick());
|
400 |
mDrawerList.setOnChildClickListener(new ExpandableListViewChildClick());
|
| 397 |
mDrawerList.setOnGroupExpandListener(new ExpandableGroupExpandListener());
|
401 |
mDrawerList.setOnGroupExpandListener(new ExpandableGroupExpandListener());
|
| 398 |
|
402 |
|
| 399 |
mDrawerList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
403 |
mDrawerList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
| 400 |
@Override
|
404 |
@Override
|
| 401 |
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
405 |
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
| Line 413... |
Line 417... |
| 413 |
mDrawerLayout,
|
417 |
mDrawerLayout,
|
| 414 |
R.drawable.menu_button_2,
|
418 |
R.drawable.menu_button_2,
|
| 415 |
R.string.drawer_open,
|
419 |
R.string.drawer_open,
|
| 416 |
R.string.drawer_close
|
420 |
R.string.drawer_close
|
| 417 |
) {
|
421 |
) {
|
| 418 |
public void onDrawerClosed(View view) {
|
422 |
/* public void onDrawerClosed(View view) {
|
| 419 |
if(titleVisible!=0) {
|
423 |
if(titleVisible!=0) {
|
| 420 |
if(titleVisible==1)
|
424 |
if(titleVisible==1)
|
| 421 |
getSupportActionBar().setCustomView(R.layout.actionbarmyfavorites);
|
425 |
getSupportActionBar().setCustomView(R.layout.actionbarmyfavorites);
|
| 422 |
|
426 |
|
| 423 |
if(titleVisible==2)
|
427 |
if(titleVisible==2)
|
| Line 444... |
Line 448... |
| 444 |
shouldGoInvisible = true;
|
448 |
shouldGoInvisible = true;
|
| 445 |
invalidateOptionsMenu();
|
449 |
invalidateOptionsMenu();
|
| 446 |
}
|
450 |
}
|
| 447 |
};
|
451 |
};
|
| 448 |
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
452 |
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
| 449 |
|
453 |
*/
|
| 450 |
|
454 |
|
| 451 |
if (savedInstanceState == null) {
|
455 |
if (savedInstanceState == null) {
|
| 452 |
|
456 |
|
| 453 |
if (flag == 7) {
|
457 |
if (flag == 7) {
|
| 454 |
getSupportActionBar().setCustomView(R.layout.actionbarhowitworks);
|
458 |
// getSupportActionBar().setCustomView(R.layout.actionbarhowitworks);
|
| 455 |
displayHelpChildView(1);
|
459 |
displayHelpChildView(1);
|
| 456 |
} else if (flag == 6) {
|
460 |
} /*else if (flag == 6) {
|
| 457 |
getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
|
461 |
getSupportActionBar().setCustomView(R.layout.actionbarcontactus);
|
| 458 |
displayHelpChildView(0);
|
462 |
displayHelpChildView(0);
|
| 459 |
} else if (flag == 15) {
|
463 |
} else if (flag == 15) {
|
| 460 |
getSupportActionBar().setCustomView(R.layout.actionbarmyprofile);
|
464 |
getSupportActionBar().setCustomView(R.layout.actionbarmyprofile);
|
| 461 |
MyProfile myProfile = new MyProfile();
|
465 |
MyProfile myProfile = new MyProfile();
|
| 462 |
this.getFragmentManager().beginTransaction()
|
466 |
this.getFragmentManager().beginTransaction()
|
| 463 |
.replace(R.id.frame_container, myProfile, "Mike")
|
467 |
.replace(R.id.frame_container, myProfile, "Mike")
|
| 464 |
.addToBackStack(null)
|
468 |
.addToBackStack(null)
|
| 465 |
.commit();
|
469 |
.commit();
|
| - |
|
470 |
}*/
|
| - |
|
471 |
else if(flag == 13){
|
| - |
|
472 |
displayView(1);
|
| - |
|
473 |
}
|
| 466 |
}else if (flag == 20) {
|
474 |
else if (flag == 20) {
|
| 467 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
475 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| 468 |
JSONObject propsNotification = new JSONObject();
|
476 |
JSONObject propsNotification = new JSONObject();
|
| 469 |
try {
|
477 |
try {
|
| 470 |
mixpanel.identify(userData.getString("id",null));
|
478 |
mixpanel.identify(userData.getString("id",null));
|
| 471 |
propsNotification.put("Screen", "Notification Url opened");
|
479 |
propsNotification.put("Screen", "Notification Url opened");
|
| 472 |
mixpanel.track("Notification Opened", propsNotification);
|
480 |
mixpanel.track("Notification Opened", propsNotification);
|
| Line 474... |
Line 482... |
| 474 |
e.printStackTrace();
|
482 |
e.printStackTrace();
|
| 475 |
}
|
483 |
}
|
| 476 |
Bundle args = new Bundle();
|
484 |
Bundle args = new Bundle();
|
| 477 |
DealsHomeFragment notifcationFragment = new DealsHomeFragment();
|
485 |
DealsHomeFragment notifcationFragment = new DealsHomeFragment();
|
| 478 |
args.putString("key", notificationURL);
|
486 |
args.putString("key", notificationURL);
|
| 479 |
this.getFragmentManager().beginTransaction()
|
- |
|
| 480 |
.replace(R.id.frame_container, notifcationFragment, "Mike")
|
- |
|
| 481 |
.addToBackStack(null)
|
- |
|
| 482 |
.commit();
|
- |
|
| 483 |
notifcationFragment.setArguments(args);
|
487 |
notifcationFragment.setArguments(args);
|
| - |
|
488 |
FragmentManager fragmentManager = getFragmentManager();
|
| - |
|
489 |
fragmentManager.popBackStack(notifcationFragment.toString(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
| - |
|
490 |
fragmentManager.beginTransaction().replace(R.id.frame_container, notifcationFragment).addToBackStack(notifcationFragment.toString()).commit();
|
| - |
|
491 |
System.gc();
|
| - |
|
492 |
|
| - |
|
493 |
|
| 484 |
}else if (flag == 31) {
|
494 |
}else if (flag == 31) {
|
| 485 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
495 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| 486 |
Bundle args = new Bundle();
|
496 |
Bundle args = new Bundle();
|
| 487 |
DealsHomeFragment redirectUrlFragment = new DealsHomeFragment();
|
497 |
DealsHomeFragment redirectUrlFragment = new DealsHomeFragment();
|
| 488 |
args.putString("key", redirectUrl);
|
498 |
args.putString("key", redirectUrl);
|
| - |
|
499 |
redirectUrlFragment.setArguments(args);
|
| 489 |
this.getFragmentManager().beginTransaction()
|
500 |
this.getFragmentManager().beginTransaction()
|
| 490 |
.replace(R.id.frame_container, redirectUrlFragment, "Mike")
|
501 |
.replace(R.id.frame_container, redirectUrlFragment, "Mike")
|
| 491 |
.addToBackStack(null)
|
502 |
.addToBackStack(null)
|
| 492 |
.commit();
|
503 |
.commit();
|
| 493 |
redirectUrlFragment.setArguments(args);
|
504 |
redirectUrlFragment.setArguments(args);
|
| 494 |
}else if (flag == 11) {
|
505 |
}/*else if (flag == 11) {
|
| 495 |
getSupportActionBar().setCustomView(R.layout.actionbaraboutus);
|
506 |
getSupportActionBar().setCustomView(R.layout.actionbaraboutus);
|
| 496 |
Bundle args = new Bundle();
|
507 |
Bundle args = new Bundle();
|
| 497 |
AboutUsFragment redirectUrlFragment = new AboutUsFragment();
|
508 |
AboutUsFragment redirectUrlFragment = new AboutUsFragment();
|
| 498 |
args.putString("key", redirectUrl);
|
509 |
args.putString("key", redirectUrl);
|
| 499 |
this.getFragmentManager().beginTransaction()
|
510 |
this.getFragmentManager().beginTransaction()
|
| 500 |
.replace(R.id.frame_container, redirectUrlFragment, "Mike")
|
511 |
.replace(R.id.frame_container, redirectUrlFragment, "Mike")
|
| 501 |
.addToBackStack(null)
|
512 |
.addToBackStack(null)
|
| 502 |
.commit();
|
513 |
.commit();
|
| 503 |
redirectUrlFragment.setArguments(args);
|
514 |
redirectUrlFragment.setArguments(args);
|
| - |
|
515 |
}*/
|
| 504 |
}else {
|
516 |
else {
|
| 505 |
getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
517 |
// getSupportActionBar().setCustomView(R.layout.actionbardeals);
|
| 506 |
displayView(0);
|
518 |
displayView(0);
|
| 507 |
}
|
519 |
}
|
| 508 |
}*/
|
520 |
}
|
| 509 |
displayView(0);
|
521 |
// displayView(0);
|
| 510 |
}
|
522 |
}
|
| 511 |
|
523 |
|
| 512 |
|
524 |
|
| 513 |
|
525 |
|
| 514 |
|
526 |
|
| Line 556... |
Line 568... |
| 556 |
}
|
568 |
}
|
| 557 |
return false;
|
569 |
return false;
|
| 558 |
}
|
570 |
}
|
| 559 |
|
571 |
|
| 560 |
}
|
572 |
}
|
| 561 |
|
573 |
*/
|
| 562 |
private void displayHelpChildView(int position) {
|
574 |
private void displayHelpChildView(int position) {
|
| 563 |
titleVisible=0;
|
575 |
titleVisible=0;
|
| 564 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
576 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 565 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
577 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 566 |
Fragment fragment = null;
|
578 |
Fragment fragment = null;
|
| Line 578... |
Line 590... |
| 578 |
t.send(new HitBuilders.EventBuilder()
|
590 |
t.send(new HitBuilders.EventBuilder()
|
| 579 |
.setCategory("Menu")
|
591 |
.setCategory("Menu")
|
| 580 |
.setAction("Contact Us ")
|
592 |
.setAction("Contact Us ")
|
| 581 |
.setLabel("Contact us Clicked")
|
593 |
.setLabel("Contact us Clicked")
|
| 582 |
.build());
|
594 |
.build());
|
| 583 |
fragment = new ContactUsFragment();
|
595 |
// fragment = new ContactUsFragment();
|
| 584 |
break;
|
596 |
break;
|
| 585 |
case 1:
|
597 |
case 1:
|
| 586 |
JSONObject propsHowItWorks = new JSONObject();
|
598 |
JSONObject propsHowItWorks = new JSONObject();
|
| 587 |
try {
|
599 |
try {
|
| 588 |
mixpanel.identify(userData.getString("id",null));
|
600 |
mixpanel.identify(userData.getString("id",null));
|
| Line 594... |
Line 606... |
| 594 |
t.send(new HitBuilders.EventBuilder()
|
606 |
t.send(new HitBuilders.EventBuilder()
|
| 595 |
.setCategory("Menu")
|
607 |
.setCategory("Menu")
|
| 596 |
.setAction("Tutorials ")
|
608 |
.setAction("Tutorials ")
|
| 597 |
.setLabel("Tutorials Clicked")
|
609 |
.setLabel("Tutorials Clicked")
|
| 598 |
.build());
|
610 |
.build());
|
| 599 |
|
- |
|
| - |
|
611 |
fragment = new HowItWorks();
|
| 600 |
break;
|
612 |
break;
|
| 601 |
case 2:
|
613 |
case 2:
|
| 602 |
JSONObject propsAboutUs = new JSONObject();
|
614 |
JSONObject propsAboutUs = new JSONObject();
|
| 603 |
try {
|
615 |
try {
|
| 604 |
mixpanel.identify(userData.getString("id",null));
|
616 |
mixpanel.identify(userData.getString("id",null));
|
| Line 610... |
Line 622... |
| 610 |
t.send(new HitBuilders.EventBuilder()
|
622 |
t.send(new HitBuilders.EventBuilder()
|
| 611 |
.setCategory("Menu")
|
623 |
.setCategory("Menu")
|
| 612 |
.setAction("About Us ")
|
624 |
.setAction("About Us ")
|
| 613 |
.setLabel("About us Clicked")
|
625 |
.setLabel("About us Clicked")
|
| 614 |
.build());
|
626 |
.build());
|
| 615 |
fragment = new AboutUsFragment();
|
627 |
// fragment = new AboutUsFragment();
|
| 616 |
break;
|
628 |
break;
|
| 617 |
default:
|
629 |
default:
|
| 618 |
break;
|
630 |
break;
|
| 619 |
}
|
631 |
}
|
| 620 |
/*if (fragment != null) {
|
632 |
/* if (fragment != null) {
|
| 621 |
FragmentManager fragmentManager = getFragmentManager();
|
633 |
FragmentManager fragmentManager = getFragmentManager();
|
| 622 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
634 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
| 623 |
|
635 |
|
| 624 |
} else {
|
636 |
} else {
|
| 625 |
Log.e("MainActivity", "Error in creating fragment");
|
637 |
Log.e("MainActivity", "Error in creating fragment");
|
| 626 |
}*/
|
638 |
}*/
|
| 627 |
/* if (fragment != null) {
|
639 |
if (fragment != null) {
|
| 628 |
FragmentManager fragmentManager = getFragmentManager();
|
640 |
FragmentManager fragmentManager = getFragmentManager();
|
| 629 |
fragmentManager.popBackStack(fragment.toString(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
641 |
fragmentManager.popBackStack(fragment.toString(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
| 630 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).addToBackStack(fragment.toString()).commit();
|
642 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).addToBackStack(fragment.toString()).commit();
|
| 631 |
System.gc();
|
643 |
System.gc();
|
| 632 |
} else {
|
644 |
} else {
|
| 633 |
Log.e("MainActivity", "Error in creating fragment");
|
645 |
Log.e("MainActivity", "Error in creating fragment");
|
| 634 |
}
|
646 |
}
|
| 635 |
|
647 |
|
| 636 |
}*/
|
648 |
}
|
| 637 |
|
649 |
|
| 638 |
@TargetApi(Build.VERSION_CODES.M)
|
650 |
@TargetApi(Build.VERSION_CODES.M)
|
| 639 |
private void checkPermission() {
|
651 |
private void checkPermission() {
|
| 640 |
if (ContextCompat.checkSelfPermission(MainActivity.this,
|
652 |
if (ContextCompat.checkSelfPermission(MainActivity.this,
|
| 641 |
Manifest.permission.READ_EXTERNAL_STORAGE) + ContextCompat
|
653 |
Manifest.permission.READ_EXTERNAL_STORAGE) + ContextCompat
|
| Line 1005... |
Line 1017... |
| 1005 |
break;
|
1017 |
break;
|
| 1006 |
case 1:
|
1018 |
case 1:
|
| 1007 |
JSONObject props1 = new JSONObject();
|
1019 |
JSONObject props1 = new JSONObject();
|
| 1008 |
try {
|
1020 |
try {
|
| 1009 |
mixpanel.identify(userData.getString("id",null));
|
1021 |
mixpanel.identify(userData.getString("id",null));
|
| 1010 |
props1.put("Screen", "Search");
|
1022 |
props1.put("Screen", "home");
|
| 1011 |
mixpanel.track("Search", props1);
|
1023 |
mixpanel.track("home", props1);
|
| 1012 |
} catch (JSONException e) {
|
1024 |
} catch (JSONException e) {
|
| 1013 |
e.printStackTrace();
|
1025 |
e.printStackTrace();
|
| 1014 |
}
|
1026 |
}
|
| 1015 |
t.send(new HitBuilders.EventBuilder()
|
1027 |
t.send(new HitBuilders.EventBuilder()
|
| 1016 |
.setCategory("Menu")
|
1028 |
.setCategory("Menu")
|
| 1017 |
.setAction("Search ")
|
1029 |
.setAction("home ")
|
| 1018 |
.setLabel("Search Clicked")
|
1030 |
.setLabel("home Clicked")
|
| 1019 |
.build());
|
1031 |
.build());
|
| 1020 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
1032 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| 1021 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Search","Search Clicked"),
|
1033 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","home","home Clicked"),
|
| 1022 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
1034 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| 1023 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1035 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 1024 |
args.putString("key", apiData.getString("search.url",null)+"?user_id="+id);
|
1036 |
args.putString("key", apiData.getString("checkRegistration","http://app.profitmandi.com/pages/checkRegistration"));
|
| 1025 |
fragment = new DealsHomeFragment();
|
1037 |
fragment = new DealsHomeFragment();
|
| 1026 |
fragment.setArguments(args);
|
1038 |
fragment.setArguments(args);
|
| 1027 |
break;
|
1039 |
break;
|
| 1028 |
default:
|
1040 |
default:
|
| 1029 |
break;
|
1041 |
break;
|
| Line 1045... |
Line 1057... |
| 1045 |
Log.e("MainActivity", "Error in creating fragment");
|
1057 |
Log.e("MainActivity", "Error in creating fragment");
|
| 1046 |
}
|
1058 |
}
|
| 1047 |
}
|
1059 |
}
|
| 1048 |
|
1060 |
|
| 1049 |
|
1061 |
|
| 1050 |
private void displayChildView(int position) {
|
1062 |
/* private void displayChildView(int position) {
|
| 1051 |
titleVisible=0;
|
1063 |
titleVisible=0;
|
| 1052 |
Bundle args = new Bundle();
|
1064 |
Bundle args = new Bundle();
|
| 1053 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
1065 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| 1054 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
1066 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
| 1055 |
String id = userData.getString("id", null);
|
1067 |
String id = userData.getString("id", null);
|
| Line 1206... |
Line 1218... |
| 1206 |
fragment.setArguments(args);
|
1218 |
fragment.setArguments(args);
|
| 1207 |
break;
|
1219 |
break;
|
| 1208 |
default:
|
1220 |
default:
|
| 1209 |
break;
|
1221 |
break;
|
| 1210 |
}
|
1222 |
}
|
| 1211 |
/*if (fragment != null) {
|
1223 |
if (fragment != null) {
|
| 1212 |
FragmentManager fragmentManager = getFragmentManager();
|
1224 |
FragmentManager fragmentManager = getFragmentManager();
|
| 1213 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
1225 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
|
| 1214 |
|
1226 |
|
| 1215 |
} else {
|
1227 |
} else {
|
| 1216 |
Log.e("MainActivity", "Error in creating fragment");
|
1228 |
Log.e("MainActivity", "Error in creating fragment");
|
| 1217 |
}*/
|
1229 |
}
|
| 1218 |
if (fragment != null) {
|
1230 |
if (fragment != null) {
|
| 1219 |
FragmentManager fragmentManager = getFragmentManager();
|
1231 |
FragmentManager fragmentManager = getFragmentManager();
|
| 1220 |
fragmentManager.popBackStack(fragment.toString(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
1232 |
fragmentManager.popBackStack(fragment.toString(),FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
| 1221 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).addToBackStack(fragment.toString()).commit();
|
1233 |
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).addToBackStack(fragment.toString()).commit();
|
| 1222 |
System.gc();
|
1234 |
System.gc();
|
| Line 1263... |
Line 1275... |
| 1263 |
{
|
1275 |
{
|
| 1264 |
for(int i = 0; i < menu.size(); i++){
|
1276 |
for(int i = 0; i < menu.size(); i++){
|
| 1265 |
menu.getItem(i).setVisible(visible);
|
1277 |
menu.getItem(i).setVisible(visible);
|
| 1266 |
}
|
1278 |
}
|
| 1267 |
}
|
1279 |
}
|
| 1268 |
@Override
|
1280 |
/* @Override
|
| 1269 |
public void onConfigurationChanged(Configuration newConfig) {
|
1281 |
public void onConfigurationChanged(Configuration newConfig) {
|
| 1270 |
super.onConfigurationChanged(newConfig);
|
1282 |
super.onConfigurationChanged(newConfig);
|
| 1271 |
mDrawerToggle.onConfigurationChanged(newConfig);
|
1283 |
//mDrawerToggle.onConfigurationChanged(newConfig);
|
| 1272 |
}
|
1284 |
}*/
|
| 1273 |
@Override
|
1285 |
@Override
|
| 1274 |
public boolean onKeyUp(int keycode, KeyEvent e) {
|
1286 |
public boolean onKeyUp(int keycode, KeyEvent e) {
|
| 1275 |
switch(keycode) {
|
1287 |
switch(keycode) {
|
| 1276 |
case KeyEvent.KEYCODE_MENU:
|
1288 |
case KeyEvent.KEYCODE_MENU:
|
| 1277 |
|
1289 |
|
| Line 1280... |
Line 1292... |
| 1280 |
}*/
|
1292 |
}*/
|
| 1281 |
}
|
1293 |
}
|
| 1282 |
|
1294 |
|
| 1283 |
return super.onKeyUp(keycode, e);
|
1295 |
return super.onKeyUp(keycode, e);
|
| 1284 |
}
|
1296 |
}
|
| - |
|
1297 |
|
| 1285 |
@Override
|
1298 |
@Override
|
| 1286 |
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
1299 |
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
| 1287 |
|
1300 |
|
| 1288 |
switch(keyCode) {
|
1301 |
switch(keyCode) {
|
| 1289 |
case KeyEvent.KEYCODE_MENU:
|
1302 |
case KeyEvent.KEYCODE_MENU:
|
| Line 1291... |
Line 1304... |
| 1291 |
mainMenu.performIdentifierAction(R.id.overflowMenu,0);
|
1304 |
mainMenu.performIdentifierAction(R.id.overflowMenu,0);
|
| 1292 |
}*/
|
1305 |
}*/
|
| 1293 |
}
|
1306 |
}
|
| 1294 |
return super.onKeyUp(keyCode, event);
|
1307 |
return super.onKeyUp(keyCode, event);
|
| 1295 |
}
|
1308 |
}
|
| - |
|
1309 |
|
| - |
|
1310 |
|
| - |
|
1311 |
|
| 1296 |
private Menu mainMenu;
|
1312 |
private Menu mainMenu;
|
| 1297 |
public final boolean isInternetOn() {
|
1313 |
public final boolean isInternetOn() {
|
| 1298 |
|
1314 |
|
| 1299 |
ConnectivityManager connec =
|
1315 |
ConnectivityManager connec =
|
| 1300 |
(ConnectivityManager)getSystemService(this.getBaseContext().CONNECTIVITY_SERVICE);
|
1316 |
(ConnectivityManager)getSystemService(this.getBaseContext().CONNECTIVITY_SERVICE);
|