Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. private void confirmationRegister(StringBuilder email, StringBuilder
  2. nickname, StringBuilder password) throws URISyntaxException, JSONException {
  3. JSONObject obj = new JSONObject();
  4. obj.put("email", email);
  5. obj.put("nick", nickname);
  6. obj.put("password", password);
  7. socket.emit("new_user", obj);
  8.  
  9. socket.on("code", new Emitter.Listener() {
  10. @Override
  11. public void call(Object... args) {
  12. JSONObject obj = (JSONObject) args[0];
  13. try {
  14. code = obj.getInt("code");
  15. if(code == 6){
  16. confirmLayout.setVisibility(View.VISIBLE);
  17. registerLayout.setVisibility(View.GONE);
  18.  
  19. }
  20. } catch (Exception e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. });
  25. }
  26.  
  27. <?xml version="1.0" encoding="utf-8"?>
  28. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  29. android:layout_width="match_parent"
  30. android:layout_height="match_parent"
  31. android:background="#2b3238">
  32.  
  33.  
  34. <LinearLayout
  35. android:layout_width="match_parent"
  36. android:layout_height="wrap_content"
  37. android:orientation="vertical"
  38. android:layout_centerVertical="true"
  39. android:id="@+id/register_layout">
  40. <LinearLayout
  41. android:layout_width="match_parent"
  42. android:layout_height="50dp"
  43. android:background="@drawable/corners"
  44. android:layout_marginLeft="40dp"
  45. android:layout_marginRight="40dp"
  46. android:orientation="horizontal">
  47. <ImageView
  48. android:layout_width="match_parent"
  49. android:layout_height="match_parent"
  50. android:padding="12dp"
  51. android:layout_weight="5"
  52. android:src="@drawable/login_edit"
  53. android:background="#373c42"
  54. android:layout_marginRight="7dp"/>
  55. <EditText
  56. android:layout_width="match_parent"
  57. android:layout_height="match_parent"
  58. android:id="@+id/email_edit_text"
  59. android:layout_weight="1"
  60. android:textSize="15sp"
  61. android:hint=" Почта"
  62. android:textColor="#FFFFFF"
  63. android:inputType="textEmailAddress"
  64. android:textColorHint="#5b626a" />
  65. </LinearLayout>
  66.  
  67. <LinearLayout
  68. android:layout_width="match_parent"
  69. android:layout_height="50dp"
  70. android:background="@drawable/corners"
  71. android:layout_marginLeft="40dp"
  72. android:layout_marginRight="40dp"
  73. android:layout_marginTop="10dp"
  74. android:orientation="horizontal">
  75. <ImageView
  76. android:layout_width="match_parent"
  77. android:layout_height="match_parent"
  78. android:layout_weight="5"
  79. android:src="@drawable/nickname_edit"
  80. android:padding="12dp"
  81. android:background="#373c42"
  82. android:layout_marginRight="7dp"/>
  83. <EditText
  84. android:layout_width="match_parent"
  85. android:layout_height="match_parent"
  86. android:id="@+id/nickname_edit"
  87. android:layout_weight="1"
  88. android:textSize="15sp"
  89. android:textColor="#FFFFFF"
  90. android:hint=" Псевдоним"
  91. android:inputType="textShortMessage"
  92. android:textColorHint="#5b626a"/>
  93.  
  94. </LinearLayout>
  95.  
  96. <LinearLayout
  97. android:layout_width="match_parent"
  98. android:layout_height="50dp"
  99. android:background="@drawable/corners"
  100. android:layout_marginLeft="40dp"
  101. android:layout_marginRight="40dp"
  102. android:layout_marginTop="10dp"
  103. android:orientation="horizontal">
  104. <ImageView
  105. android:layout_width="match_parent"
  106. android:layout_height="match_parent"
  107. android:layout_weight="5"
  108. android:src="@drawable/password_edit"
  109. android:padding="12dp"
  110. android:background="#373c42"
  111. android:layout_marginRight="7dp"/>
  112. <EditText
  113. android:layout_width="match_parent"
  114. android:layout_height="match_parent"
  115. android:id="@+id/password_edit_text"
  116. android:layout_weight="1"
  117. android:textSize="15sp"
  118. android:textColor="#FFFFFF"
  119. android:hint=" Пароль"
  120. android:inputType="textPassword"
  121. android:textColorHint="#5b626a"/>
  122.  
  123.  
  124. </LinearLayout>
  125. <Button
  126. android:layout_width="match_parent"
  127. android:layout_height="wrap_content"
  128. android:layout_marginTop="10dp"
  129. android:layout_marginLeft="80dp"
  130. android:layout_marginRight="80dp"
  131. android:text="Регистрация"
  132. android:id="@+id/register_button"/>
  133.  
  134. </LinearLayout>
  135.  
  136. <LinearLayout
  137. android:layout_width="match_parent"
  138. android:layout_height="wrap_content"
  139. android:orientation="vertical"
  140. android:layout_centerVertical="true"
  141. android:visibility="gone"
  142. android:id="@+id/confirm_email_layout">
  143. <LinearLayout
  144. android:layout_width="match_parent"
  145. android:layout_height="50dp"
  146. android:background="@drawable/corners"
  147. android:layout_marginLeft="40dp"
  148. android:layout_marginRight="40dp"
  149. android:orientation="horizontal">
  150. <ImageView
  151. android:layout_width="match_parent"
  152. android:layout_height="match_parent"
  153. android:padding="12dp"
  154. android:layout_weight="5"
  155. android:src="@drawable/confirm_email_edit"
  156. android:background="#373c42"
  157. android:layout_marginRight="7dp"/>
  158. <EditText
  159. android:layout_width="match_parent"
  160. android:layout_height="match_parent"
  161. android:id="@+id/confirm_email_edit"
  162. android:layout_weight="1"
  163. android:textSize="15sp"
  164. android:hint=" Код из письма"
  165. android:textColor="#FFFFFF"
  166. android:inputType="numberDecimal"
  167. android:textColorHint="#5b626a" />
  168. </LinearLayout>
  169. <Button
  170. android:layout_width="match_parent"
  171. android:layout_height="wrap_content"
  172. android:layout_marginTop="10dp"
  173. android:layout_marginLeft="80dp"
  174. android:layout_marginRight="80dp"
  175. android:text="Подтвердить"
  176. android:id="@+id/confirm_email_button"/>
  177. </LinearLayout>
  178.  
  179. </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement