| Line 1... |
Line 1... |
| 1 |
package com.saholic.profittill.main;
|
1 |
package com.saholic.profittill.main;
|
| 2 |
|
2 |
|
| - |
|
3 |
import android.app.Fragment;
|
| 3 |
import android.app.ProgressDialog;
|
4 |
import android.app.ProgressDialog;
|
| 4 |
import android.content.Context;
|
5 |
import android.content.Context;
|
| 5 |
import android.content.Intent;
|
6 |
import android.content.Intent;
|
| 6 |
import android.content.SharedPreferences;
|
7 |
import android.content.SharedPreferences;
|
| 7 |
import android.graphics.Bitmap;
|
8 |
import android.graphics.Bitmap;
|
| Line 9... |
Line 10... |
| 9 |
import android.graphics.Canvas;
|
10 |
import android.graphics.Canvas;
|
| 10 |
import android.graphics.Paint;
|
11 |
import android.graphics.Paint;
|
| 11 |
import android.net.ConnectivityManager;
|
12 |
import android.net.ConnectivityManager;
|
| 12 |
import android.os.AsyncTask;
|
13 |
import android.os.AsyncTask;
|
| 13 |
import android.os.Bundle;
|
14 |
import android.os.Bundle;
|
| 14 |
import android.app.Fragment;
|
- |
|
| 15 |
import android.text.TextUtils;
|
- |
|
| 16 |
import android.util.Base64;
|
- |
|
| 17 |
import android.util.Log;
|
15 |
import android.util.Log;
|
| 18 |
import android.view.KeyEvent;
|
16 |
import android.view.KeyEvent;
|
| 19 |
import android.view.LayoutInflater;
|
17 |
import android.view.LayoutInflater;
|
| 20 |
import android.view.View;
|
18 |
import android.view.View;
|
| 21 |
import android.view.ViewGroup;
|
19 |
import android.view.ViewGroup;
|
| 22 |
import android.webkit.WebView;
|
- |
|
| 23 |
import android.widget.Button;
|
20 |
import android.widget.Button;
|
| 24 |
import android.widget.EditText;
|
21 |
import android.widget.EditText;
|
| 25 |
import android.widget.ImageView;
|
22 |
import android.widget.ImageView;
|
| 26 |
import android.widget.TextView;
|
23 |
import android.widget.TextView;
|
| 27 |
import android.widget.Toast;
|
24 |
import android.widget.Toast;
|
| Line 29... |
Line 26... |
| 29 |
import com.google.android.gms.analytics.HitBuilders;
|
26 |
import com.google.android.gms.analytics.HitBuilders;
|
| 30 |
import com.google.android.gms.analytics.Tracker;
|
27 |
import com.google.android.gms.analytics.Tracker;
|
| 31 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
28 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
| 32 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
29 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
| 33 |
import com.saholic.profittill.R;
|
30 |
import com.saholic.profittill.R;
|
| - |
|
31 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
| - |
|
32 |
import com.saholic.profittill.Volley.Analytics;
|
| - |
|
33 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
| - |
|
34 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
| 34 |
import com.squareup.picasso.Picasso;
|
35 |
import com.squareup.picasso.Picasso;
|
| 35 |
import com.squareup.picasso.Transformation;
|
36 |
import com.squareup.picasso.Transformation;
|
| 36 |
import com.testin.agent.TestinAgent;
|
37 |
import com.testin.agent.TestinAgent;
|
| 37 |
|
38 |
|
| 38 |
import org.apache.http.HttpEntity;
|
39 |
import org.apache.http.HttpEntity;
|
| Line 41... |
Line 42... |
| 41 |
import org.apache.http.client.ClientProtocolException;
|
42 |
import org.apache.http.client.ClientProtocolException;
|
| 42 |
import org.apache.http.client.HttpClient;
|
43 |
import org.apache.http.client.HttpClient;
|
| 43 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
44 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
| 44 |
import org.apache.http.client.methods.HttpGet;
|
45 |
import org.apache.http.client.methods.HttpGet;
|
| 45 |
import org.apache.http.client.methods.HttpPost;
|
46 |
import org.apache.http.client.methods.HttpPost;
|
| 46 |
import org.apache.http.entity.StringEntity;
|
- |
|
| 47 |
import org.apache.http.impl.client.DefaultHttpClient;
|
47 |
import org.apache.http.impl.client.DefaultHttpClient;
|
| 48 |
import org.apache.http.message.BasicNameValuePair;
|
48 |
import org.apache.http.message.BasicNameValuePair;
|
| 49 |
import org.apache.http.util.EntityUtils;
|
49 |
import org.apache.http.util.EntityUtils;
|
| 50 |
import org.json.JSONException;
|
50 |
import org.json.JSONException;
|
| 51 |
import org.json.JSONObject;
|
51 |
import org.json.JSONObject;
|
| Line 70... |
Line 70... |
| 70 |
|
70 |
|
| 71 |
|
71 |
|
| 72 |
@Override
|
72 |
@Override
|
| 73 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
73 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
| 74 |
Bundle savedInstanceState) {
|
74 |
Bundle savedInstanceState) {
|
| 75 |
// Inflate the layout for this fragment
|
- |
|
| 76 |
View rootView = inflater.inflate(R.layout.fragment_my_profile, container, false);
|
75 |
View rootView = inflater.inflate(R.layout.fragment_my_profile, container, false);
|
| 77 |
TestinAgent.init(getActivity());
|
76 |
TestinAgent.init(getActivity());
|
| 78 |
MixpanelAPI mixpanel = MixpanelAPI.getInstance(getActivity(), ProfitTillConstants.MIX_PANEL_TOKEN);
|
77 |
MixpanelAPI mixpanel = MixpanelAPI.getInstance(getActivity(), ProfitTillConstants.MIX_PANEL_TOKEN);
|
| 79 |
|
78 |
|
| 80 |
Tracker t = ((GoogleAnalyticsTracker) getActivity().getApplicationContext()).getTracker(
|
79 |
Tracker t = ((GoogleAnalyticsTracker) getActivity().getApplicationContext()).getTracker(
|
| Line 118... |
Line 117... |
| 118 |
} catch (JSONException e) {
|
117 |
} catch (JSONException e) {
|
| 119 |
e.printStackTrace();
|
118 |
e.printStackTrace();
|
| 120 |
}
|
119 |
}
|
| 121 |
editTextDisabled();
|
120 |
editTextDisabled();
|
| 122 |
if(isInternetOn()){
|
121 |
if(isInternetOn()){
|
| - |
|
122 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
123 |
AnalyticsUtility.getAnalyticsRequest(getActivity(), userData.getString("id", ""), "Screen", "My Profile", "My Profile Screen"),
|
| - |
|
124 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
125 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(getActivity());
|
| 123 |
pd = new ProgressDialog(getActivity());
|
126 |
pd = new ProgressDialog(getActivity());
|
| 124 |
pd.setTitle("Please wait");
|
127 |
pd.setTitle("Please wait");
|
| 125 |
pd.setMessage("Fetching Profile Information..");
|
128 |
pd.setMessage("Fetching Profile Information..");
|
| 126 |
pd.show();
|
129 |
pd.show();
|
| 127 |
new fetchUserData().execute();
|
130 |
new fetchUserData().execute();
|
| Line 479... |
Line 482... |
| 479 |
@Override
|
482 |
@Override
|
| 480 |
public void onClick(View v) {
|
483 |
public void onClick(View v) {
|
| 481 |
|
484 |
|
| 482 |
if((phoneNumberMyProfile.getText().toString().length()==10 || phoneNumberMyProfile.getText().toString().isEmpty()) && (pincodeMyProfile.getText().toString().length()==6 || pincodeMyProfile.getText().toString().isEmpty())) {
|
485 |
if((phoneNumberMyProfile.getText().toString().length()==10 || phoneNumberMyProfile.getText().toString().isEmpty()) && (pincodeMyProfile.getText().toString().length()==6 || pincodeMyProfile.getText().toString().isEmpty())) {
|
| 483 |
if (isInternetOn()) {
|
486 |
if (isInternetOn()) {
|
| - |
|
487 |
|
| - |
|
488 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
489 |
AnalyticsUtility.getAnalyticsRequest(getActivity(), userData.getString("id", ""), "Clicks", "My Profile", "Save Address Details"),
|
| - |
|
490 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
491 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(getActivity());
|
| - |
|
492 |
|
| 484 |
nameValuePairsProfile = new ArrayList<NameValuePair>();
|
493 |
nameValuePairsProfile = new ArrayList<NameValuePair>();
|
| 485 |
nameValuePairsProfile.add(new BasicNameValuePair("id", userData.getString("id", null)));
|
494 |
nameValuePairsProfile.add(new BasicNameValuePair("id", userData.getString("id", null)));
|
| 486 |
nameValuePairsProfile.add(new BasicNameValuePair("mobile_number", phoneNumberMyProfile.getText().toString()));
|
495 |
nameValuePairsProfile.add(new BasicNameValuePair("mobile_number", phoneNumberMyProfile.getText().toString()));
|
| 487 |
nameValuePairsProfile.add(new BasicNameValuePair("address_line_1", addressLine1MyProfile.getText().toString()));
|
496 |
nameValuePairsProfile.add(new BasicNameValuePair("address_line_1", addressLine1MyProfile.getText().toString()));
|
| 488 |
nameValuePairsProfile.add(new BasicNameValuePair("address_line_2", addressLine2MyProfile.getText().toString()));
|
497 |
nameValuePairsProfile.add(new BasicNameValuePair("address_line_2", addressLine2MyProfile.getText().toString()));
|
| Line 640... |
Line 649... |
| 640 |
|
649 |
|
| 641 |
Picasso.with(getActivity())
|
650 |
Picasso.with(getActivity())
|
| 642 |
.load(updatedUrl)
|
651 |
.load(updatedUrl)
|
| 643 |
.transform(new CircleTransform())
|
652 |
.transform(new CircleTransform())
|
| 644 |
.into(profileImage);
|
653 |
.into(profileImage);
|
| 645 |
//Toast.makeText(getActivity(),"facebook "+profileImageUrl,Toast.LENGTH_SHORT).show();
|
- |
|
| 646 |
} else {
|
654 |
} else {
|
| 647 |
profileImage.setImageResource(R.drawable.noimageavailable);
|
655 |
profileImage.setImageResource(R.drawable.noimageavailable);
|
| 648 |
profileImage.setMaxHeight(300);
|
656 |
profileImage.setMaxHeight(300);
|
| 649 |
profileImage.setMaxWidth(300);
|
657 |
profileImage.setMaxWidth(300);
|
| 650 |
}
|
658 |
}
|
| 651 |
|
659 |
|
| 652 |
if (result.getString("mobile_verified") == "true") {
|
660 |
if (result.getString("mobile_verified") == "true") {
|
| 653 |
phoneNumberMyProfileVerifyStatus.setText("Verified");
|
661 |
phoneNumberMyProfileVerifyStatus.setText("Verified");
|
| 654 |
/*phoneNumberMyProfileVerifyStatus.setClickable(true);
|
- |
|
| 655 |
phoneNumberMyProfileVerifyStatus.setOnClickListener(new View.OnClickListener() {
|
- |
|
| 656 |
@Override
|
- |
|
| 657 |
public void onClick(View v) {
|
- |
|
| 658 |
Intent i = new Intent(getActivity(),MObileNumberVerificationActivity.class);
|
- |
|
| 659 |
i.putExtra("numberVerification",phoneNumberMyProfile.getText().toString());
|
- |
|
| 660 |
startActivity(i);
|
- |
|
| 661 |
}
|
- |
|
| 662 |
});*/
|
- |
|
| 663 |
} else {
|
662 |
} else {
|
| 664 |
phoneNumberMyProfileVerifyStatus.setText("Verify Now to get Cashback");
|
663 |
phoneNumberMyProfileVerifyStatus.setText("Verify Now to get Cashback");
|
| 665 |
phoneNumberMyProfileVerifyStatus.setClickable(true);
|
664 |
phoneNumberMyProfileVerifyStatus.setClickable(true);
|
| 666 |
if (isInternetOn()) {
|
665 |
if (isInternetOn()) {
|
| 667 |
if (phoneNumberMyProfile.getText().toString().isEmpty() || phoneNumberMyProfile.getText().toString().length() != 10) {
|
666 |
if (phoneNumberMyProfile.getText().toString().isEmpty() || phoneNumberMyProfile.getText().toString().length() != 10) {
|
| 668 |
Toast.makeText(getActivity(), "Please Enter a number to be verified", Toast.LENGTH_SHORT).show();
|
667 |
Toast.makeText(getActivity(), "Please Enter a number to be verified", Toast.LENGTH_SHORT).show();
|
| 669 |
} else {
|
668 |
} else {
|
| 670 |
phoneNumberMyProfileVerifyStatus.setOnClickListener(new View.OnClickListener() {
|
669 |
phoneNumberMyProfileVerifyStatus.setOnClickListener(new View.OnClickListener() {
|
| 671 |
@Override
|
670 |
@Override
|
| 672 |
public void onClick(View v) {
|
671 |
public void onClick(View v) {
|
| - |
|
672 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
673 |
AnalyticsUtility.getAnalyticsRequest(getActivity(), userData.getString("id", ""), "Clicks", "My Profile", "Verify Number"),
|
| - |
|
674 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
675 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(getActivity());
|
| 673 |
Intent i = new Intent(getActivity(), MObileNumberVerificationActivity.class);
|
676 |
Intent i = new Intent(getActivity(), MObileNumberVerificationActivity.class);
|
| 674 |
i.putExtra("numberVerification", phoneNumberMyProfile.getText().toString());
|
677 |
i.putExtra("numberVerification", phoneNumberMyProfile.getText().toString());
|
| 675 |
startActivity(i);
|
678 |
startActivity(i);
|
| 676 |
}
|
679 |
}
|
| 677 |
});
|
680 |
});
|