Skip to content

Commit 2ddf0bd

Browse files
committed
iproved login and registration added informals logo
1 parent e651e8a commit 2ddf0bd

File tree

9 files changed

+81
-43
lines changed

9 files changed

+81
-43
lines changed

app/src/main/java/dpi/ks19/participantapp/Activities/ClusterCardsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
3333
//icons for clusters
3434
icons = new ArrayList<>();
3535
icons.add(R.drawable.logo_ks);
36-
icons.add(R.drawable.logo_ks);
36+
icons.add(R.drawable.logo_informals);
3737
icons.add(R.drawable.logo_arts);
3838
icons.add(R.drawable.logo_studio);
3939
icons.add(R.drawable.logo_english_lits);

app/src/main/java/dpi/ks19/participantapp/Adapter/ClusterAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public ClusterAdapter(Context mContext, int d) {
5252

5353

5454
clusterIcon.add(R.drawable.logo_ks);
55-
clusterIcon.add(R.drawable.logo_ks);
55+
clusterIcon.add(R.drawable.logo_informals);
5656
clusterIcon.add(R.drawable.logo_arts);
5757
clusterIcon.add(R.drawable.logo_studio);
5858
clusterIcon.add(R.drawable.logo_english_lits);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dpi.ks19.participantapp.CallbackInterface;
22

33
public interface OTPSent {
4-
void otpSent(boolean isSuccess);
4+
void otpSent(boolean isSuccess, boolean isRegistered);
55
}

app/src/main/java/dpi/ks19/participantapp/Fragments/LoginPagerFragment.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import android.app.ProgressDialog;
44
import android.content.Intent;
5+
import android.net.Uri;
56
import android.os.Bundle;
67
import android.support.annotation.NonNull;
78
import android.support.annotation.Nullable;
89
import android.support.design.widget.Snackbar;
910
import android.support.v4.app.Fragment;
11+
import android.util.Log;
1012
import android.view.LayoutInflater;
1113
import android.view.View;
1214
import android.view.ViewGroup;
@@ -17,9 +19,8 @@
1719
import butterknife.BindView;
1820
import butterknife.ButterKnife;
1921
import butterknife.OnClick;
20-
import dpi.ks19.participantapp.Activities.ClusterCardsActivity;
21-
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
2222
import dpi.ks19.participantapp.CallbackInterface.OTPSent;
23+
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
2324
import dpi.ks19.participantapp.MainScreen;
2425
import dpi.ks19.participantapp.Networking.ApiHelper;
2526
import dpi.ks19.participantapp.R;
@@ -70,13 +71,18 @@ public void onClickLogin(View view){
7071
}
7172

7273
@Override
73-
public void otpSent(boolean isSuccess) {
74+
public void otpSent(boolean isSuccess, boolean isRegistered) {
75+
Log.d("REACHED","OTP_SENT");
7476
progressDialog.cancel();
7577
if(isSuccess){
76-
//calling dialog to enter OTP
77-
createOTPDialog();
78+
if(isRegistered){
79+
//calling dialog to enter OTP
80+
createOTPDialog();
81+
}else{
82+
Toast.makeText(getActivity(),"User not Registered",Toast.LENGTH_LONG).show();
83+
}
7884
}else{
79-
Toast.makeText(getActivity(),"Please try again",Toast.LENGTH_SHORT).show();
85+
Toast.makeText(getActivity(),"Please try again",Toast.LENGTH_LONG).show();
8086
}
8187
}
8288

@@ -116,4 +122,11 @@ public void onClickGuest(View view){
116122
startActivity(intent);
117123
}
118124

125+
@OnClick(R.id.privacy_text)
126+
public void privacyPolicyClicked(View v){
127+
String url = "https://github.com/droidLight/ks19_privacypolicy/blob/master/privacy_policy.md";
128+
Intent i = new Intent(Intent.ACTION_VIEW);
129+
i.setData(Uri.parse(url));
130+
startActivity(i);
131+
}
119132
}

app/src/main/java/dpi/ks19/participantapp/Fragments/RegisterPagerFragment.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.app.ProgressDialog;
44
import android.content.Intent;
5-
import android.graphics.Color;
65
import android.os.Bundle;
76
import android.support.annotation.NonNull;
87
import android.support.annotation.Nullable;
@@ -15,22 +14,15 @@
1514

1615
import android.widget.CheckBox;
1716

18-
import android.widget.ArrayAdapter;
19-
import android.widget.AutoCompleteTextView;
2017
import android.widget.EditText;
2118
import android.widget.Toast;
2219

23-
import org.json.JSONArray;
24-
import org.json.JSONException;
25-
2620
import butterknife.BindView;
2721
import butterknife.ButterKnife;
2822
import butterknife.OnClick;
2923
import dpi.ks19.participantapp.Activities.CollegeListActivity;
30-
import dpi.ks19.participantapp.CallbackInterface.CollegeInterface;
31-
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
3224
import dpi.ks19.participantapp.CallbackInterface.OTPSent;
33-
import dpi.ks19.participantapp.MainScreen;
25+
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
3426
import dpi.ks19.participantapp.Networking.ApiHelper;
3527
import dpi.ks19.participantapp.R;
3628

@@ -110,14 +102,19 @@ public void onClickRegister(View view){
110102
}
111103

112104
@Override
113-
public void otpSent(boolean isSuccess) {
105+
public void otpSent(boolean isSuccess, boolean isRegistered) {
114106
progressDialog.cancel();
115-
//only show otp dialog is otp is sent
107+
//only show otp dialog if otp is sent
116108
if(isSuccess){
117-
//create a OTP dialog to enter the otp
118-
createOTPDialog();
109+
if(!isRegistered){
110+
//create a OTP dialog to enter the otp
111+
createOTPDialog();
112+
}else{
113+
Toast.makeText(getActivity(),"Already Registered",Toast.LENGTH_LONG).show();
114+
}
115+
119116
}else{
120-
Toast.makeText(getActivity(),"Please try again",Toast.LENGTH_SHORT).show();
117+
Toast.makeText(getActivity(),"Please try again",Toast.LENGTH_LONG).show();
121118
}
122119
}
123120

app/src/main/java/dpi/ks19/participantapp/Networking/ApiHelper.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import dpi.ks19.participantapp.Adapter.ClusterAdapter;
2929
import dpi.ks19.participantapp.CallbackInterface.CollegeInterface;
3030
import dpi.ks19.participantapp.CallbackInterface.EventsByCluster;
31-
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
3231
import dpi.ks19.participantapp.CallbackInterface.OTPSent;
32+
import dpi.ks19.participantapp.CallbackInterface.OTPInterface;
3333
import dpi.ks19.participantapp.CallbackInterface.QrResponse;
3434
import dpi.ks19.participantapp.Model.EventClass;
3535
import dpi.ks19.participantapp.R;
@@ -72,14 +72,22 @@ public void generateOTP(String email, final OTPSent callback){
7272
JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST, URL, json, new Response.Listener<JSONObject>() {
7373
@Override
7474
public void onResponse(JSONObject response) {
75-
callback.otpSent(true);
7675
Log.d("GENERATE_JSON_RESPONSE", response.toString());
76+
try{
77+
String msg = response.getString("msg");
78+
if(msg.equals("Already Registered")){
79+
callback.otpSent(true, true);
80+
}
81+
}catch (Exception e){
82+
callback.otpSent(true, false);
83+
}
84+
7785
}
7886
}, new Response.ErrorListener() {
7987
@Override
8088
public void onErrorResponse(VolleyError error) {
8189

82-
callback.otpSent(false);
90+
callback.otpSent(false, false);
8391
Log.d("GENERATE_JSON_ERROR",error.toString());
8492
}
8593
});
@@ -188,16 +196,21 @@ public void loginUser(String email, final OTPSent callback){
188196
JsonObjectRequest loginRequest = new JsonObjectRequest(Request.Method.POST, URL, params, new Response.Listener<JSONObject>() {
189197
@Override
190198
public void onResponse(JSONObject response) {
191-
192-
callback.otpSent(true);
199+
try{
200+
String msg = response.getString("msg");
201+
if(msg.equals("No Email found")){
202+
callback.otpSent(true, false);
203+
}
204+
}catch (Exception e){
205+
callback.otpSent(true, true);
206+
}
193207
Log.d("LOGIN_RESPONSE",response.toString());
194-
195208
}
196209
}, new Response.ErrorListener() {
197210
@Override
198211
public void onErrorResponse(VolleyError error) {
199212

200-
callback.otpSent(false);
213+
callback.otpSent(false, false);
201214
Log.d("LOGIN_ERROR",error.toString());
202215

203216
}
38 KB
Loading

app/src/main/res/layout/frag_login.xml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<android.support.constraint.ConstraintLayout
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:tools="http://schemas.android.com/tools"
56
android:layout_width="match_parent"
67
android:layout_height="match_parent">
78
<android.support.constraint.ConstraintLayout
@@ -106,34 +107,30 @@
106107
android:layout_width="match_parent"
107108
android:layout_height="wrap_content"
108109

109-
android:layout_marginTop="32dp"
110-
android:layout_marginBottom="8dp"
111110
android:layout_marginStart="@dimen/margin_36dp"
111+
android:layout_marginTop="32dp"
112112
android:layout_marginEnd="@dimen/margin_36dp"
113-
android:src="@drawable/white_border"
114113
android:background="@drawable/ripple_effect_white"
115114
android:elevation="@dimen/cardview_compat_inset_shadow"
116-
117115
android:fontFamily="@font/sniglet_regular"
116+
118117
android:onClick="onClickLogin"
119118
android:padding="8dp"
119+
android:src="@drawable/white_border"
120120
android:text="@string/login"
121-
android:textStyle="bold"
122-
123121
android:textColor="@android:color/white"
122+
124123
android:textSize="20sp"
125-
app:layout_constraintBottom_toTopOf="@+id/guest"
124+
android:textStyle="bold"
126125
app:layout_constraintEnd_toEndOf="parent"
127126
app:layout_constraintStart_toStartOf="parent"
128-
app:layout_constraintTop_toBottomOf="@+id/input_txt_layout_login_email"
129-
app:layout_constraintVertical_bias="1.0" />
127+
app:layout_constraintTop_toBottomOf="@+id/input_txt_layout_login_email" />
130128

131129
<Button
132130
android:id="@+id/guest"
133131
android:layout_width="wrap_content"
134132
android:layout_height="30dp"
135-
android:layout_marginTop="4dp"
136-
android:layout_marginBottom="8dp"
133+
android:layout_marginTop="8dp"
137134
android:background="@drawable/ripple_effect_white"
138135
android:elevation="@dimen/cardview_compat_inset_shadow"
139136
android:fontFamily="@font/sniglet_regular"
@@ -142,10 +139,26 @@
142139
android:text="Enter as guest"
143140
android:textColor="@android:color/white"
144141
android:textSize="16sp"
145-
app:layout_constraintBottom_toBottomOf="parent"
146142
app:layout_constraintEnd_toEndOf="parent"
147-
app:layout_constraintStart_toStartOf="parent" />
143+
app:layout_constraintStart_toStartOf="parent"
144+
app:layout_constraintTop_toBottomOf="@+id/btn_login" />
148145

146+
<TextView
147+
android:id="@+id/privacy_text"
148+
android:layout_width="wrap_content"
149+
android:layout_height="wrap_content"
150+
android:layout_marginStart="8dp"
151+
android:layout_marginTop="8dp"
152+
android:layout_marginEnd="8dp"
153+
android:layout_marginBottom="8dp"
154+
android:fontFamily="@font/sniglet_regular"
155+
android:onClick="privacyPolicyClicked"
156+
android:textColor="@color/white"
157+
android:text="@string/privacy_policy_text"
158+
app:layout_constraintBottom_toBottomOf="parent"
159+
app:layout_constraintEnd_toEndOf="parent"
160+
app:layout_constraintStart_toStartOf="parent"
161+
app:layout_constraintTop_toBottomOf="@+id/guest" />
149162
</android.support.constraint.ConstraintLayout>
150163

151164
</android.support.constraint.ConstraintLayout>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<string name="hostel_accomodation">Hostel accomodation needed</string>
3434
<string name="tamil_sangam_display_text">சாஸ்த்ரா தமிழ்ச் சங்கம்</string>
3535
<string name="tamil_sangam_query_text">Tamil Lits</string>
36+
<string name="privacy_policy_text">By Logging in you are accepting our privacy policy</string>
37+
3638
<!--clusters-->
3739
<string-array name="cluster_list">
3840
<item>FlagShip Event</item>

0 commit comments

Comments
 (0)