Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void confirmationRegister(StringBuilder email, StringBuilder
- nickname, StringBuilder password) throws URISyntaxException, JSONException {
- JSONObject obj = new JSONObject();
- obj.put("email", email);
- obj.put("nick", nickname);
- obj.put("password", password);
- socket.emit("new_user", obj);
- socket.on("code", new Emitter.Listener() {
- @Override
- public void call(Object... args) {
- JSONObject obj = (JSONObject) args[0];
- try {
- code = obj.getInt("code");
- if(code == 6){
- confirmLayout.setVisibility(View.VISIBLE);
- registerLayout.setVisibility(View.GONE);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#2b3238">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_centerVertical="true"
- android:id="@+id/register_layout">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:background="@drawable/corners"
- android:layout_marginLeft="40dp"
- android:layout_marginRight="40dp"
- android:orientation="horizontal">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="12dp"
- android:layout_weight="5"
- android:src="@drawable/login_edit"
- android:background="#373c42"
- android:layout_marginRight="7dp"/>
- <EditText
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/email_edit_text"
- android:layout_weight="1"
- android:textSize="15sp"
- android:hint=" Почта"
- android:textColor="#FFFFFF"
- android:inputType="textEmailAddress"
- android:textColorHint="#5b626a" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:background="@drawable/corners"
- android:layout_marginLeft="40dp"
- android:layout_marginRight="40dp"
- android:layout_marginTop="10dp"
- android:orientation="horizontal">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="5"
- android:src="@drawable/nickname_edit"
- android:padding="12dp"
- android:background="#373c42"
- android:layout_marginRight="7dp"/>
- <EditText
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/nickname_edit"
- android:layout_weight="1"
- android:textSize="15sp"
- android:textColor="#FFFFFF"
- android:hint=" Псевдоним"
- android:inputType="textShortMessage"
- android:textColorHint="#5b626a"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:background="@drawable/corners"
- android:layout_marginLeft="40dp"
- android:layout_marginRight="40dp"
- android:layout_marginTop="10dp"
- android:orientation="horizontal">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="5"
- android:src="@drawable/password_edit"
- android:padding="12dp"
- android:background="#373c42"
- android:layout_marginRight="7dp"/>
- <EditText
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/password_edit_text"
- android:layout_weight="1"
- android:textSize="15sp"
- android:textColor="#FFFFFF"
- android:hint=" Пароль"
- android:inputType="textPassword"
- android:textColorHint="#5b626a"/>
- </LinearLayout>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginLeft="80dp"
- android:layout_marginRight="80dp"
- android:text="Регистрация"
- android:id="@+id/register_button"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_centerVertical="true"
- android:visibility="gone"
- android:id="@+id/confirm_email_layout">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:background="@drawable/corners"
- android:layout_marginLeft="40dp"
- android:layout_marginRight="40dp"
- android:orientation="horizontal">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="12dp"
- android:layout_weight="5"
- android:src="@drawable/confirm_email_edit"
- android:background="#373c42"
- android:layout_marginRight="7dp"/>
- <EditText
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/confirm_email_edit"
- android:layout_weight="1"
- android:textSize="15sp"
- android:hint=" Код из письма"
- android:textColor="#FFFFFF"
- android:inputType="numberDecimal"
- android:textColorHint="#5b626a" />
- </LinearLayout>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginLeft="80dp"
- android:layout_marginRight="80dp"
- android:text="Подтвердить"
- android:id="@+id/confirm_email_button"/>
- </LinearLayout>
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement