Skip to content
This repository has been archived by the owner on Jun 28, 2020. It is now read-only.

Commit

Permalink
Added guest login and chatbot improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince Bansal authored and Prince Bansal committed Oct 17, 2016
1 parent b91eef1 commit 7fee2cd
Show file tree
Hide file tree
Showing 54 changed files with 379 additions and 2,414 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/app-arm64-v8a-release.apk
Binary file not shown.
Binary file modified app/app-armeabi-v7a-release.apk
Binary file not shown.
Binary file modified app/app-mips-release.apk
Binary file not shown.
Binary file modified app/app-x86-release.apk
Binary file not shown.
Binary file modified app/app-x86_64-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
universalApk false
}
}
project.ext.versionCodes = [ 'armeabi-v7a': 3, 'arm64-v8a': 4, 'mips': 6, 'x86': 7, 'x86_64': 10]
project.ext.versionCodes = [ 'armeabi-v7a': 12, 'arm64-v8a': 13, 'mips': 14, 'x86': 15, 'x86_64': 16]

android.applicationVariants.all { variant ->
// assign different version code for each output
Expand Down Expand Up @@ -69,4 +69,4 @@ dependencies {
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.caverock:androidsvg:1.2.1'
//compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.1'
}
}
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BIND_VOICE_INTERACTION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected Map<String, String> getParams() throws AuthFailureError {
}


public void timeline(final String email, final String auth_token) {
public void timeline(final String email, final String auth_token, final boolean isGuest) {

String url = APIContract.getTimelineUrl();
mServerAuthenticateListener.onRequestInitiated(TIMELINE_CODE);
Expand Down Expand Up @@ -170,7 +170,11 @@ public void onErrorResponse(VolleyError error) {
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return APIContract.getTimelineParams(email, auth_token);
if (!isGuest) {
return APIContract.getTimelineParams(email, auth_token);
} else {
return APIContract.getGuestParams();
}
}
};

Expand All @@ -181,9 +185,9 @@ protected Map<String, String> getParams() throws AuthFailureError {
}


public void qrCodeScan(final String email, final String authToken, final String codeData){
public void qrCodeScan(final String email, final String authToken, final String codeData) {

String urlQrAdmin = " " ;
String urlQrAdmin = " ";

StringRequest qrAdminRequest = new StringRequest(Request.Method.POST, urlQrAdmin,
new Response.Listener<String>() {
Expand All @@ -198,23 +202,23 @@ public void onErrorResponse(VolleyError error) {
Log.e(TAG, "onErrorResponse: " + error.getMessage());
/*Back to UI*/
}
}){
}) {
@Override
protected Map<String, String> getPostParams() throws AuthFailureError {
HashMap<String, String> mapBody = new HashMap<>() ;
mapBody.put("email", email) ;
mapBody.put("authToken", authToken) ;
mapBody.put("data", codeData) ;
return mapBody ;
HashMap<String, String> mapBody = new HashMap<>();
mapBody.put("email", email);
mapBody.put("authToken", authToken);
mapBody.put("data", codeData);
return mapBody;
}
} ;
};

AppController.getInstance().addToRequestQueue(qrAdminRequest);

}


public void speakers(final String email, final String auth_token) {
public void speakers(final String email, final String auth_token, final boolean isGuest) {

String url = APIContract.getSpeakersUrl();
mServerAuthenticateListener.onRequestInitiated(SPEAKERS_CODE);
Expand Down Expand Up @@ -247,7 +251,11 @@ public void onErrorResponse(VolleyError error) {
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return APIContract.getSpeakersParams(email, auth_token);
if (!isGuest)
return APIContract.getSpeakersParams(email, auth_token);
else {
return APIContract.getGuestParams();
}
}
};

Expand Down Expand Up @@ -303,7 +311,7 @@ public void onErrorResponse(VolleyError error) {
}


public void faq(final String email, final String auth_token) {
public void faq(final String email, final String auth_token, final boolean isGuest) {

String url = APIContract.getFAQUrl();
mServerAuthenticateListener.onRequestInitiated(FAQ_CODE);
Expand Down Expand Up @@ -338,7 +346,10 @@ public void onErrorResponse(VolleyError error) {
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return APIContract.getFAQParams(email, auth_token);
if (!isGuest)
return APIContract.getFAQParams(email, auth_token);
else
return APIContract.getGuestParams();
}
};

Expand Down Expand Up @@ -438,7 +449,7 @@ protected Map<String, String> getParams() throws AuthFailureError {
}


public void allApis(final String email, final String auth_token) {
public void allApis(final String email, final String auth_token, boolean isGuest) {

String url = APIContract.getAllAPIsUrl();
mServerAuthenticateListener.onRequestInitiated(ALL_APIS_CODE);
Expand All @@ -449,8 +460,9 @@ public void onResponse(String response) {
Log.i(TAG, "APIResult:onResponse: " + response);
try {
//TODO Change response format in backend. Its returning Json Array now. change to JsonObject
if (validateResponse("{ "+"\"response\""+":"+response+"}")) {
List<BaseAPI> apiList = CustomTypeAdapter.typeRealmString().fromJson(response, new TypeToken<List<BaseAPI>>(){}.getType());
if (validateResponse("{ " + "\"response\"" + ":" + response + "}")) {
List<BaseAPI> apiList = CustomTypeAdapter.typeRealmString().fromJson(response, new TypeToken<List<BaseAPI>>() {
}.getType());
mServerAuthenticateListener.onRequestCompleted(ALL_APIS_CODE, apiList);
} else {
mServerAuthenticateListener.onRequestError(ALL_APIS_CODE, ErrorDefinitions.getMessage(ErrorDefinitions.CODE_WRONG_FORMAT));
Expand Down Expand Up @@ -509,7 +521,7 @@ public void onErrorResponse(VolleyError error) {
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return APIContract.getSlotParams(email, auth_token,isWinner, slots);
return APIContract.getSlotParams(email, auth_token, isWinner, slots);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ public static boolean calculateTime(String startTime, String endTime) {
try {
startTime = startTime.replaceAll("T", "");
startTime = startTime.replaceAll("/", "");
startTime = startTime.replaceAll(":", "");
endTime = endTime.replaceAll("T", "");
endTime = endTime.replaceAll("/", "");
endTime = endTime.replaceAll(":", "");
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyHHmm");
long startDate = sdf.parse(startTime).getTime();
long endDate = sdf.parse(endTime).getTime();
long cur=System.currentTimeMillis();
Log.i("assa", "calculateTime: "+startDate+":"+endDate+":"+cur);
if(startDate<=cur&&endDate>=cur){
return true;
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,10 @@ public static String getChatBotParams(String email, String question) {
}
return "";
}

public static Map<String, String> getGuestParams() {
Map<String, String> map = new HashMap<>();
map.put("isGuest", "true");
return map;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gdgvitvellore.devfest.Control.DataGenerator;

import android.net.Uri;

import com.gdgvitvellore.devfest.Entity.About.Fragments.AboutFragment;
import com.gdgvitvellore.devfest.Entity.About.Fragments.AboutFragment.Group;
import com.gdgvitvellore.devfest.Entity.Actors.Child;
Expand Down Expand Up @@ -108,7 +110,7 @@ public static Group getContacts(AboutFragment aboutFragment){
child2.setImageType(Child.IMAGE_RESOURCE);
child2.setImageResource(R.drawable.ic_website);
//child2.setImageResource(R.drawable.ic_gdg);
child2.setDesignation("http://gdgvitvellore.com/");
child2.setDesignation("http://www.gdgvitvellore.com");

Child child3=new Child();
child3.setName("Google+");
Expand All @@ -122,21 +124,28 @@ public static Group getContacts(AboutFragment aboutFragment){
child4.setImageType(Child.IMAGE_RESOURCE);
child4.setImageResource(R.drawable.ic_email);
// child4.setImageResource(R.drawable.ic_gdg);
child4.setDesignation("[email protected]");
child4.setDesignation("mailto:[email protected]");

Child child5=new Child();
child5.setName("CALL");
child5.setImageType(Child.IMAGE_RESOURCE);
child5.setImageResource(R.drawable.ic_call);
//child5.setImageResource(R.drawable.ic_gdg);
child5.setDesignation("+917708150636");
child5.setDesignation("tel:+917708150636");

Child child6=new Child();
child6.setName("FIND US");
child6.setImageType(Child.IMAGE_RESOURCE);
child6.setImageResource(R.drawable.ic_mappin);
//child6.setImageResource(R.drawable.ic_gdg);
child6.setDesignation("http://facebook.com/gdgvitvellore");
double latitude = 12.970684;
double longitude = 79.163667;
String label = "GDG VIT Vellore";
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";
child6.setDesignation(uriString);

childList.add(child1);
childList.add(child2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand Down Expand Up @@ -35,6 +36,7 @@
import com.gdgvitvellore.devfest.Entity.Actors.SpeakersResult;
import com.gdgvitvellore.devfest.Entity.Actors.User;
import com.gdgvitvellore.devfest.Entity.Authentication.Activities.AuthenticationActivity;
import com.gdgvitvellore.devfest.Entity.Main.Activities.MainActivity;
import com.gdgvitvellore.devfest.gdgdevfest.R;

import java.util.ArrayList;
Expand Down Expand Up @@ -76,13 +78,16 @@ private void init(View rootView) {
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
speakersRecyclerView = (RecyclerView) rootView.findViewById(R.id.speakers_recycler_view);
progressDialog = new ProgressDialog(getContext());
connectAPI = new ConnectAPI(getContext());
root = (CoordinatorLayout) rootView.findViewById(R.id.root);

connectAPI = new ConnectAPI(getContext());
groupList = new ArrayList<>();
user = DataHandler.getInstance(getContext()).getUser();
if (user == null) {
startActivity(new Intent(getActivity(), AuthenticationActivity.class));
getActivity().finish();
if (!MainActivity.ISGUEST) {
if (user == null) {
startActivity(new Intent(getActivity(), AuthenticationActivity.class));
getActivity().finish();
}
}
}

Expand All @@ -107,7 +112,10 @@ private void setSpeakers() {
speakersAdapter = new SpeakersAdapter(getContext());
speakersRecyclerView.setAdapter(speakersAdapter);
} else {
connectAPI.speakers(user.getEmail(), user.getAuthToken());
if (!MainActivity.ISGUEST)
connectAPI.speakers(user.getEmail(), user.getAuthToken(), false);
else
connectAPI.speakers(null, null, true);
}
}

Expand Down Expand Up @@ -257,17 +265,19 @@ public class ItemViewHolder extends ChildViewHolder {
private TextView mItemTextView, desgination;
private ImageView info;
private CircleImageView mImageView;
private View holder;

public ItemViewHolder(View itemView) {
super(itemView);
holder = itemView;
mImageView = (CircleImageView) itemView.findViewById(R.id.photo);
info = (ImageView) itemView.findViewById(R.id.info);
mItemTextView = (TextView) itemView.findViewById(R.id.name);
desgination = (TextView) itemView.findViewById(R.id.designation);
}

public void bind(Object item) {
Child child = (Child) item;
final Child child = (Child) item;
if (child.getImageType() == Child.IMAGE_URL) {
desgination.setVisibility(View.VISIBLE);
mItemTextView.setText(child.getName());
Expand All @@ -279,6 +289,28 @@ public void bind(Object item) {
mImageView.setImageResource(child.getImageResource());
desgination.setVisibility(View.GONE);
info.setVisibility(View.GONE);
holder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getAdapterPosition() == 4) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(child.getDesignation()));
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
startActivity(intent);
}
} else if(getAdapterPosition()==3){
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(child.getDesignation()));
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
startActivity(intent);
}
} else{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(child.getDesignation()));
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
startActivity(intent);
}

}
}
});
}
}
}
Expand Down
Loading

0 comments on commit 7fee2cd

Please sign in to comment.