gender addition
This commit is contained in:
parent
2b4dc9e3c2
commit
31e70bf8d5
|
@ -4,7 +4,9 @@
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="PLATFORM" />
|
<compositeConfiguration>
|
||||||
|
<compositeBuild compositeDefinitionSource="SCRIPT" />
|
||||||
|
</compositeConfiguration>
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
|
@ -14,6 +16,7 @@
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
<option name="testRunner" value="PLATFORM" />
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -20,5 +20,4 @@ public class LoginRequest extends StringRequest {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getParams() {
|
public Map<String, String> getParams() {
|
||||||
return params;
|
return params;
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class Registerequest extends StringRequest {
|
||||||
private static final String REGISTER_REQUEST_URL = "https://eclectic-sweeps.000webhostapp.com/registration_enc.php";
|
private static final String REGISTER_REQUEST_URL = "https://eclectic-sweeps.000webhostapp.com/registration_enc.php";
|
||||||
private Map<String, String> params;
|
private Map<String, String> params;
|
||||||
|
|
||||||
public Registerequest(String firstname, String lastname,String username,String dob,String email,String password, Response.Listener<String> listener) {
|
public Registerequest(String firstname, String lastname,String username,String dob,String email,String password,String gender, Response.Listener<String> listener) {
|
||||||
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
|
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
params.put("username", username);
|
params.put("username", username);
|
||||||
|
@ -19,7 +19,7 @@ public class Registerequest extends StringRequest {
|
||||||
params.put("lastname", lastname);
|
params.put("lastname", lastname);
|
||||||
params.put("dob",dob);
|
params.put("dob",dob);
|
||||||
params.put("email",email);
|
params.put("email",email);
|
||||||
|
params.put("gender",gender);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,22 +49,23 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
private EditText email_id;
|
private EditText email_id;
|
||||||
private Button signup;
|
private Button signup;
|
||||||
private Button signup_button;
|
private Button signup_button;
|
||||||
int sex;
|
String gender;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_registration);
|
setContentView(R.layout.activity_registration);
|
||||||
|
|
||||||
|
|
||||||
username = (EditText) findViewById(R.id.reg_username);
|
username = findViewById(R.id.reg_username);
|
||||||
password = (EditText) findViewById(R.id.reg_password);
|
password = findViewById(R.id.reg_password);
|
||||||
firstname = (EditText) findViewById(R.id.firstname);
|
firstname = findViewById(R.id.firstname);
|
||||||
lastname = (EditText) findViewById(R.id.lastname);
|
lastname = findViewById(R.id.lastname);
|
||||||
email_id = (EditText) findViewById(R.id.email_id);
|
email_id = findViewById(R.id.email_id);
|
||||||
signup = (Button) findViewById(R.id.signup_button);
|
signup = findViewById(R.id.signup_button);
|
||||||
signin = (TextView) findViewById(R.id.signIn_text);
|
signin = findViewById(R.id.signIn_text);
|
||||||
dob = (TextView) findViewById(R.id.dob1);
|
dob = findViewById(R.id.dob1);
|
||||||
signup_button = (Button) findViewById(R.id.signup_button);
|
|
||||||
|
radioSexGroup = findViewById(R.id.radioSex);
|
||||||
signin.setOnClickListener(new View.OnClickListener() {
|
signin.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -74,6 +75,36 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dob.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
DialogFragment datePicker = new DatePickerFragment();
|
||||||
|
datePicker.show(getSupportFragmentManager(), "date picker");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button back = (Button) findViewById(R.id.back);
|
||||||
|
|
||||||
|
back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// get selected radio button from radioGroup
|
||||||
|
int selectedId = radioSexGroup.getCheckedRadioButtonId();
|
||||||
|
|
||||||
|
//find the radiobutton by returned id
|
||||||
|
radioSexButton = (RadioButton) findViewById(selectedId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signup.setOnClickListener(new View.OnClickListener() {
|
signup.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -95,7 +126,7 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
JSONObject jsonResponse = new JSONObject(response);
|
JSONObject jsonResponse = new JSONObject(response);
|
||||||
boolean success = jsonResponse.getBoolean("success");
|
boolean success = jsonResponse.getBoolean("success");
|
||||||
if (success) {
|
if (success) {
|
||||||
Intent intent = new Intent(registration.this,login.class);
|
Intent intent = new Intent(registration.this,UserAreaActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(registration.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(registration.this);
|
||||||
|
@ -109,7 +140,7 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Registerequest reg_request = new Registerequest(firstname.getText().toString(),lastname.getText().toString(),username.getText().toString(),dob.getText().toString(),email_id.getText().toString(),password.getText().toString(),responseListener);
|
Registerequest reg_request = new Registerequest(firstname.getText().toString(),lastname.getText().toString(),username.getText().toString(),dob.getText().toString(),email_id.getText().toString(),password.getText().toString(),radioSexButton.getText().toString(),responseListener);
|
||||||
RequestQueue queue = Volley.newRequestQueue(registration.this);
|
RequestQueue queue = Volley.newRequestQueue(registration.this);
|
||||||
queue.add(reg_request);
|
queue.add(reg_request);
|
||||||
|
|
||||||
|
@ -120,23 +151,6 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dob.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
DialogFragment datePicker = new DatePickerFragment();
|
|
||||||
datePicker.show(getSupportFragmentManager(), "date picker");
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Button back = (Button) findViewById(R.id.back);
|
|
||||||
|
|
||||||
back.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
onBackPressed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,45 +179,24 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListenerOnButton() {
|
|
||||||
|
|
||||||
radioSexGroup = (RadioGroup) findViewById(R.id.radioSex);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get selected radio button from radioGroup
|
|
||||||
int selectedId = radioSexGroup.getCheckedRadioButtonId();
|
|
||||||
|
|
||||||
//find the radiobutton by returned id
|
|
||||||
radioSexButton = (RadioButton) findViewById(selectedId);
|
|
||||||
|
|
||||||
if(radioSexButton.getText() == "Male"){
|
|
||||||
sex = 1;
|
|
||||||
}
|
|
||||||
else if (radioSexButton.getText() == "Female"){
|
|
||||||
|
|
||||||
sex = 2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
sex = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void checkButton(View v) {
|
||||||
|
int radioId = radioSexGroup.getCheckedRadioButtonId();
|
||||||
|
|
||||||
|
radioSexButton = findViewById(radioId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isEmpty(EditText etText) {
|
public boolean isEmpty(EditText etText) {
|
||||||
return etText.getText().toString().trim().length() == 0;
|
return etText.getText().toString().trim().length() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showToast() {
|
/*public void showToast() {
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toast_root));
|
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toast_root));
|
||||||
|
|
||||||
|
@ -219,7 +212,7 @@ public class registration extends AppCompatActivity implements DatePickerDialog.
|
||||||
toast.setView(layout);
|
toast.setView(layout);
|
||||||
|
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
android:text="Register to save your progress and get detailed report"
|
android:text="Register to save your progress and get detailed report"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp"
|
||||||
|
android:autofillHints="username"
|
||||||
|
/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/reg_username"
|
android:id="@+id/reg_username"
|
||||||
|
@ -52,7 +54,9 @@
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:autofillHints="username"
|
||||||
|
/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/reg_password"
|
android:id="@+id/reg_password"
|
||||||
|
@ -63,16 +67,18 @@
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Password"
|
android:hint="Password"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPassword"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:autofillHints="password"
|
||||||
|
/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/firstname"
|
android:id="@+id/firstname"
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="42dp"
|
android:layout_height="42dp"
|
||||||
|
android:autofillHints="username"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
|
@ -95,7 +101,9 @@
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:autofillHints="username"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dob1"
|
android:id="@+id/dob1"
|
||||||
|
@ -108,7 +116,9 @@
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Date of birth"
|
android:hint="Date of birth"
|
||||||
android:labelFor="@id/dob1"
|
android:labelFor="@id/dob1"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:text="@string/Dob"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +131,9 @@
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="E-Mail ID"
|
android:hint="E-Mail ID"
|
||||||
android:inputType="textEmailAddress" />
|
android:inputType="textEmailAddress"
|
||||||
|
android:autofillHints="email"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -143,7 +155,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3.33"
|
android:layout_weight="3.33"
|
||||||
android:text="Male"
|
android:text="Male"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:onClick="checkButton"
|
||||||
|
/>
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/radioButton4"
|
android:id="@+id/radioButton4"
|
||||||
|
@ -151,7 +165,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3.33"
|
android:layout_weight="3.33"
|
||||||
android:text="Female"
|
android:text="Female"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:onClick="checkButton"/>
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/radioButton5"
|
android:id="@+id/radioButton5"
|
||||||
|
@ -159,7 +174,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3.33"
|
android:layout_weight="3.33"
|
||||||
android:text="Others"
|
android:text="Others"
|
||||||
android:visibility="visible" />
|
android:visibility="visible"
|
||||||
|
android:onClick="checkButton"
|
||||||
|
/>
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
@ -167,7 +184,7 @@
|
||||||
android:id="@+id/input_group"
|
android:id="@+id/input_group"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_marginLeft="25dp"
|
android:layout_marginLeft="25dp"
|
||||||
android:layout_marginRight="25dp"
|
android:layout_marginRight="25dp"
|
||||||
android:layout_marginBottom="132dp"
|
android:layout_marginBottom="132dp"
|
||||||
|
@ -191,8 +208,10 @@
|
||||||
android:text="Already Have an Account? Sign in"
|
android:text="Already Have an Account? Sign in"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="13dp"
|
android:textSize="13sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:focusable="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/signup_button"
|
android:id="@+id/signup_button"
|
||||||
|
@ -200,7 +219,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/button"
|
android:background="@drawable/button"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:text="SIGN UP"
|
android:text="SIGN UP"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="#ff9966"
|
android:textColor="#ff9966"
|
||||||
|
|
|
@ -4,5 +4,14 @@
|
||||||
<string name="alz">alz.</string>
|
<string name="alz">alz.</string>
|
||||||
<string name="never_forget">never forget</string>
|
<string name="never_forget">never forget</string>
|
||||||
<string name="login">login</string>
|
<string name="login">login</string>
|
||||||
|
<string name="SIGN_UP">SIGN_UP</string>
|
||||||
|
<string name="reg_banner">Register to save your progress and get detailed report</string>
|
||||||
|
<string name="Username">Username</string>
|
||||||
|
<string name="Password">Password</string>
|
||||||
|
<string name="First_name">First name</string>
|
||||||
|
<string name="Last_name">Last name</string>
|
||||||
|
<string name="Dob">Date of Birth</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue