Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. package com.samerzmd.enlightendhighcouncil.modeles;
  2.  
  3. import android.os.Parcel;
  4. import android.os.Parcelable;
  5.  
  6. import com.google.gson.annotations.SerializedName;
  7. import com.samerzmd.enlightendhighcouncil.maps.MapPoint;
  8. import com.samerzmd.enlightendhighcouncil.security.MCrypt;
  9.  
  10. /**
  11. * Created by CubicArt on 8/19/14.
  12. */
  13. public class User extends MapPoint implements Parcelable {
  14. MCrypt mCrypt=new MCrypt();
  15. @SerializedName("agentName")
  16. private String agentName;
  17. @SerializedName("GPlusUrl")
  18. private String GPlusUrl;
  19. @SerializedName("latitude")
  20. private String latitude;
  21. @SerializedName("longitude")
  22. private String longitude;
  23.  
  24. public String getAgentName() {
  25.  
  26. try {
  27. String realName=MCrypt.bytesToHex(mCrypt.decrypt(agentName));
  28. return realName;
  29. } catch (Exception e) {
  30. e.printStackTrace();
  31. }
  32. return "";
  33. }
  34.  
  35. public String getGPlusUrl() {
  36. try {
  37. return MCrypt.bytesToHex(mCrypt.decrypt(GPlusUrl));
  38. } catch (Exception e) {
  39. e.printStackTrace();
  40. }
  41. return "";
  42. }
  43.  
  44. @Override
  45. public double getLongitude() {
  46. try {
  47. return Double.valueOf(MCrypt.bytesToHex(mCrypt.decrypt(longitude)));
  48. } catch (Exception e) {
  49. e.printStackTrace();
  50. }
  51. return 0;
  52. }
  53.  
  54. @Override
  55. public double getLatitude() {
  56. try {
  57. double lat=Double.valueOf(MCrypt.bytesToHex(mCrypt.decrypt(latitude)));
  58. return lat;
  59. } catch (Exception e) {
  60. e.printStackTrace();
  61. }
  62. return 0;
  63. }
  64.  
  65. protected User(Parcel in) {
  66. mCrypt = (MCrypt) in.readValue(MCrypt.class.getClassLoader());
  67. agentName = in.readString();
  68. GPlusUrl = in.readString();
  69. latitude = in.readString();
  70. longitude = in.readString();
  71. }
  72.  
  73. @Override
  74. public int describeContents() {
  75. return 0;
  76. }
  77.  
  78. @Override
  79. public void writeToParcel(Parcel dest, int flags) {
  80. dest.writeValue(mCrypt);
  81. dest.writeString(agentName);
  82. dest.writeString(GPlusUrl);
  83. dest.writeString(latitude);
  84. dest.writeString(longitude);
  85. }
  86.  
  87. @SuppressWarnings("unused")
  88. public static final Parcelable.Creator<User> CREATOR = new Parcelable.Creator<User>() {
  89. @Override
  90. public User createFromParcel(Parcel in) {
  91. return new User(in);
  92. }
  93.  
  94. @Override
  95. public User[] newArray(int size) {
  96. return new User[size];
  97. }
  98. };
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement