Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/donor/oncall/DonorApi/DonorApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface DonorApi {
void login(@Body JsonObject jsonVal, Callback<Response> callback);



@Headers("Content-Type: application/json")
@POST("/register")
void register(@Body JsonObject jsonVal, Callback<Response> callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
*/
public class ServiceGenerator {


public static final String production_domain = "http://45.55.137.90:8000";
public static final String debug_domain = "http://192.168.0.103:8000";


private static RestAdapter.Builder builder = new RestAdapter.Builder()
.setEndpoint(production_domain)
.setClient(new OkClient(new OkHttpClient()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ public void setUpLogin(){
rootView.findViewById(R.id.signin).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

JsonObject jsonObject = new JsonObject();
if (validateEmailIdAndPassword()) {
progressDialog.show();
try {

jsonObject.addProperty("userName", username);
jsonObject.addProperty("password", password);


donorApi.login(jsonObject, new Callback<Response>() {
@Override
public void success(Response response, Response response2) {
Expand All @@ -129,11 +130,13 @@ public void success(Response response, Response response2) {

@Override
public void failure(RetrofitError error) {

String json = new String(((TypedByteArray)error.getResponse().getBody()).getBytes());
JsonParser parser = new JsonParser();
JsonObject errorJson = parser.parse(json).getAsJsonObject();
passwordField.setError(errorJson.get("error").getAsString());
progressDialog.dismiss();

}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public boolean checkPwd(){
if (isNullOrEmpty(password)){
if (isNullOrEmpty(cfrmpassword)){
if (!password.equals(cfrmpassword)){
cfrmpwdField.setError("Passwords donot match");
cfrmpwdField.setError("Passwords do not match");
status = false;
}
}else {
Expand Down Expand Up @@ -182,7 +182,8 @@ public boolean checkPhoneNumber(){
if (!isNullOrEmpty(phnnumber))
{
phnnumberField.setError("Phone Number cannot be empty");
status =false;

status = false;
}
return status;
}
Expand Down Expand Up @@ -222,27 +223,30 @@ public void onClick(View v) {
if (validateFields()){
try {
progressDialog.show();


jsonObject.addProperty("password", password);
jsonObject.addProperty("name", name);
jsonObject.addProperty("bloodGroup", bloodGrp);
jsonObject.addProperty("dob", dob);
jsonObject.addProperty("phoneNo",phnnumber);
jsonObject.addProperty("email", email);

Log.d(TAG,jsonObject.toString());
donorApi.register(jsonObject,new Callback< Response >() {
@Override
public void success(Response response, Response response2) {
Log.d(TAG, "Success " + response.getReason());

progressDialog.setMessage("Thank you for Signin up");
// String json = new String(((TypedByteArray) response.getBody()).getBytes());

replaceViewFragment(new LoginFragment(),false);
progressDialog.dismiss();

}

@Override
public void failure(RetrofitError error) {

new AlertDialog.Builder(getContext())
.setTitle("User Already Exists")
.setMessage("Email id has been already signed up. Please use forgot password to login.")
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout/registeration_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
android:id="@+id/pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="password" />
android:hint="password"
android:password="true"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_cfrmpwd"
Expand All @@ -96,7 +97,8 @@
android:id="@+id/cfrmpwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="confirm password" />
android:hint="confirm password"
android:password="true"/>
</android.support.design.widget.TextInputLayout>

<Spinner
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'

classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:2.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon Nov 30 14:34:04 IST 2015
#Thu Jun 16 12:02:58 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down