| Line 24... |
Line 24... |
| 24 |
import android.os.SystemClock;
|
24 |
import android.os.SystemClock;
|
| 25 |
import android.support.v4.app.ActionBarDrawerToggle;
|
25 |
import android.support.v4.app.ActionBarDrawerToggle;
|
| 26 |
import android.support.v4.app.ActivityCompat;
|
26 |
import android.support.v4.app.ActivityCompat;
|
| 27 |
import android.support.v4.content.ContextCompat;
|
27 |
import android.support.v4.content.ContextCompat;
|
| 28 |
import android.support.v4.widget.DrawerLayout;
|
28 |
import android.support.v4.widget.DrawerLayout;
|
| 29 |
import android.support.v7.app.ActionBarActivity;
|
29 |
import android.support.v7.app.AppCompatActivity;
|
| 30 |
import android.util.Log;
|
30 |
import android.util.Log;
|
| 31 |
import android.view.KeyEvent;
|
31 |
import android.view.KeyEvent;
|
| 32 |
import android.view.Menu;
|
32 |
import android.view.Menu;
|
| 33 |
import android.view.View;
|
33 |
import android.view.View;
|
| 34 |
import android.view.ViewConfiguration;
|
34 |
import android.view.ViewConfiguration;
|
| Line 75... |
Line 75... |
| 75 |
import java.util.HashMap;
|
75 |
import java.util.HashMap;
|
| 76 |
import java.util.List;
|
76 |
import java.util.List;
|
| 77 |
import java.util.Map;
|
77 |
import java.util.Map;
|
| 78 |
|
78 |
|
| 79 |
|
79 |
|
| 80 |
public class MainActivity extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
80 |
public class MainActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
| 81 |
public GoogleApiClient mGoogleApiClient;
|
81 |
public GoogleApiClient mGoogleApiClient;
|
| 82 |
SharedPreferences userData;
|
82 |
SharedPreferences userData;
|
| 83 |
SharedPreferences apiData;
|
83 |
SharedPreferences apiData;
|
| 84 |
boolean glogout;
|
84 |
boolean glogout;
|
| 85 |
SharedPreferences.Editor userDataEditor;
|
85 |
SharedPreferences.Editor userDataEditor;
|
| Line 105... |
Line 105... |
| 105 |
private String[] mPlanetTitles;
|
105 |
private String[] mPlanetTitles;
|
| 106 |
private String[] mHelpTtiles;
|
106 |
private String[] mHelpTtiles;
|
| 107 |
private int selectedPosition;
|
107 |
private int selectedPosition;
|
| 108 |
//List<ExpandableNavigationItem> listParent;
|
108 |
//List<ExpandableNavigationItem> listParent;
|
| 109 |
HashMap<String, List<String>> listDataChild;
|
109 |
HashMap<String, List<String>> listDataChild;
|
| 110 |
public static final int SMS_RECIEVE_PERMISSION = 100;
|
110 |
// public static final int SMS_RECIEVE_PERMISSION = 100;
|
| 111 |
public static final int CAMERA_PERMISSION = 101;
|
111 |
public static final int CAMERA_PERMISSION = 101;
|
| 112 |
public static final int Storage_permission=102;
|
112 |
public static final int Storage_permission=102;
|
| 113 |
private boolean PermissionIngranted=false;
|
113 |
private boolean PermissionIngranted=false;
|
| 114 |
|
114 |
|
| 115 |
|
115 |
|
| Line 334... |
Line 334... |
| 334 |
catch (Exception e){
|
334 |
catch (Exception e){
|
| 335 |
e.printStackTrace();
|
335 |
e.printStackTrace();
|
| 336 |
}
|
336 |
}
|
| 337 |
}
|
337 |
}
|
| 338 |
|
338 |
|
| 339 |
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
339 |
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.app_red)));
|
| 340 |
//getSupportActionBar().setIcon(R.drawable.backarrow);
|
340 |
//getSupportActionBar().setIcon(R.drawable.backarrow);
|
| 341 |
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
341 |
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
| 342 |
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
342 |
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
| 343 |
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
343 |
final Drawable upArrow = getResources().getDrawable(R.drawable.com_mixpanel_android_arrowleft);
|
| 344 |
upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
344 |
//upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
| 345 |
getSupportActionBar().setHomeAsUpIndicator(upArrow);
|
345 |
getSupportActionBar().setHomeAsUpIndicator(upArrow);
|
| 346 |
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
346 |
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
| 347 |
getSupportActionBar().setHomeButtonEnabled(true);
|
347 |
getSupportActionBar().setHomeButtonEnabled(true);
|
| 348 |
getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
|
348 |
getSupportActionBar().setCustomView(R.layout.actionbarprofittill);
|
| 349 |
|
349 |
|
| Line 650... |
Line 650... |
| 650 |
@TargetApi(Build.VERSION_CODES.M)
|
650 |
@TargetApi(Build.VERSION_CODES.M)
|
| 651 |
private void checkPermission() {
|
651 |
private void checkPermission() {
|
| 652 |
if (ContextCompat.checkSelfPermission(MainActivity.this,
|
652 |
if (ContextCompat.checkSelfPermission(MainActivity.this,
|
| 653 |
Manifest.permission.READ_EXTERNAL_STORAGE) + ContextCompat
|
653 |
Manifest.permission.READ_EXTERNAL_STORAGE) + ContextCompat
|
| 654 |
.checkSelfPermission(MainActivity.this,
|
654 |
.checkSelfPermission(MainActivity.this,
|
| 655 |
Manifest.permission.CAMERA) + ContextCompat
|
655 |
Manifest.permission.CAMERA)
|
| 656 |
.checkSelfPermission(MainActivity.this,Manifest.permission.RECEIVE_SMS)
|
- |
|
| 657 |
!= PackageManager.PERMISSION_GRANTED) {
|
656 |
!= PackageManager.PERMISSION_GRANTED) {
|
| 658 |
|
657 |
|
| 659 |
if (ActivityCompat.shouldShowRequestPermissionRationale
|
658 |
if (ActivityCompat.shouldShowRequestPermissionRationale
|
| 660 |
(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) ||
|
659 |
(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) ||
|
| 661 |
ActivityCompat.shouldShowRequestPermissionRationale
|
660 |
ActivityCompat.shouldShowRequestPermissionRationale
|
| 662 |
(MainActivity.this, Manifest.permission.CAMERA)|| ActivityCompat.shouldShowRequestPermissionRationale
|
- |
|
| 663 |
(MainActivity.this, Manifest.permission.RECEIVE_SMS)) {
|
661 |
(MainActivity.this, Manifest.permission.CAMERA)) {
|
| 664 |
|
662 |
|
| 665 |
requestPermissions(
|
663 |
requestPermissions(
|
| 666 |
new String[]{Manifest.permission
|
664 |
new String[]{Manifest.permission
|
| 667 |
.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA,Manifest.permission
|
665 |
.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA},
|
| 668 |
.RECEIVE_SMS},
|
- |
|
| 669 |
123);
|
666 |
123);
|
| 670 |
|
667 |
|
| 671 |
} else {
|
668 |
} else {
|
| 672 |
requestPermissions(
|
669 |
requestPermissions(
|
| 673 |
new String[]{Manifest.permission
|
670 |
new String[]{Manifest.permission
|
| 674 |
.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA,Manifest.permission.RECEIVE_SMS},
|
671 |
.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA},
|
| 675 |
123);
|
672 |
123);
|
| 676 |
}
|
673 |
}
|
| 677 |
} else {
|
674 |
} else {
|
| 678 |
// write your logic code if permission already granted
|
675 |
// write your logic code if permission already granted
|
| 679 |
}
|
676 |
}
|
| Line 1007... |
Line 1004... |
| 1007 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
1004 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| 1008 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Deals","Deals Clicked"),
|
1005 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","Deals","Deals Clicked"),
|
| 1009 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
1006 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| 1010 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1007 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 1011 |
String dealsUrl=apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point");
|
1008 |
String dealsUrl=apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point");
|
| 1012 |
//String dealsUrl="http://192.168.120.96:4200/entry-point";
|
1009 |
//String dealsUrl=("http://192.168.120.52:4200/entry-point");
|
| 1013 |
//String dealsUrl=ProfitTillConstants.Web_Uri;
|
- |
|
| 1014 |
args.putString("key",dealsUrl);
|
1010 |
args.putString("key",dealsUrl);
|
| 1015 |
fragment = new DealsHomeFragment();
|
1011 |
fragment = new DealsHomeFragment();
|
| 1016 |
fragment.setArguments(args);
|
1012 |
fragment.setArguments(args);
|
| 1017 |
break;
|
1013 |
break;
|
| 1018 |
case 1:
|
1014 |
case 1:
|
| Line 1031... |
Line 1027... |
| 1031 |
.build());
|
1027 |
.build());
|
| 1032 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
1028 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| 1033 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","home","home Clicked"),
|
1029 |
AnalyticsUtility.getAnalyticsRequest(MainActivity.this,userData.getString("id",""),"Menu","home","home Clicked"),
|
| 1034 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
1030 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| 1035 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
1031 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MainActivity.this);
|
| 1036 |
args.putString("key", apiData.getString("checkRegistration","http://app.profitmandi.com/pages/checkRegistration"));
|
1032 |
args.putString("key", apiData.getString("checkRegistration","http://app.profitmandi.com/pages/checkRegistration"));
|
| - |
|
1033 |
// args.putString("key", "http://192.168.120.52:4200/pages/checkRegistration");
|
| 1037 |
fragment = new DealsHomeFragment();
|
1034 |
fragment = new DealsHomeFragment();
|
| 1038 |
fragment.setArguments(args);
|
1035 |
fragment.setArguments(args);
|
| 1039 |
break;
|
1036 |
break;
|
| 1040 |
default:
|
1037 |
default:
|
| 1041 |
break;
|
1038 |
break;
|
| Line 1374... |
Line 1371... |
| 1374 |
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
|
1371 |
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
|
| 1375 |
am.cancel(pi);
|
1372 |
am.cancel(pi);
|
| 1376 |
am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 60 * 1000, 30 * 60 * 1000, pi);
|
1373 |
am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 60 * 1000, 30 * 60 * 1000, pi);
|
| 1377 |
invalidateOptionsMenu();
|
1374 |
invalidateOptionsMenu();
|
| 1378 |
}
|
1375 |
}
|
| 1379 |
}
|
- |
|
| 1380 |
|
1376 |
}
|
| - |
|
1377 |
|