diff --git a/.idea/misc.xml b/.idea/misc.xml index 696e050..14299dc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -60,7 +60,7 @@ - + diff --git a/app/app-arm64-v8a-release.apk b/app/app-arm64-v8a-release.apk index c2285c3..34aef57 100644 Binary files a/app/app-arm64-v8a-release.apk and b/app/app-arm64-v8a-release.apk differ diff --git a/app/app-armeabi-v7a-release.apk b/app/app-armeabi-v7a-release.apk index c7c8c29..c1c522a 100644 Binary files a/app/app-armeabi-v7a-release.apk and b/app/app-armeabi-v7a-release.apk differ diff --git a/app/app-mips-release.apk b/app/app-mips-release.apk index c33e679..4d17295 100644 Binary files a/app/app-mips-release.apk and b/app/app-mips-release.apk differ diff --git a/app/app-x86-release.apk b/app/app-x86-release.apk index 79d86c8..152cb48 100644 Binary files a/app/app-x86-release.apk and b/app/app-x86-release.apk differ diff --git a/app/app-x86_64-release.apk b/app/app-x86_64-release.apk index a7cb9b7..55219dc 100644 Binary files a/app/app-x86_64-release.apk and b/app/app-x86_64-release.apk differ diff --git a/app/build.gradle b/app/build.gradle index 08369af..0186cdc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 @@ -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' -} +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 294e321..5c55562 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -43,7 +43,6 @@ - diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Boundary/API/ConnectAPI.java b/app/src/main/java/com/gdgvitvellore/devfest/Boundary/API/ConnectAPI.java index c839c0a..3646c9f 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Boundary/API/ConnectAPI.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Boundary/API/ConnectAPI.java @@ -137,7 +137,7 @@ protected Map 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); @@ -170,7 +170,11 @@ public void onErrorResponse(VolleyError error) { }) { @Override protected Map getParams() throws AuthFailureError { - return APIContract.getTimelineParams(email, auth_token); + if (!isGuest) { + return APIContract.getTimelineParams(email, auth_token); + } else { + return APIContract.getGuestParams(); + } } }; @@ -181,9 +185,9 @@ protected Map 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() { @@ -198,23 +202,23 @@ public void onErrorResponse(VolleyError error) { Log.e(TAG, "onErrorResponse: " + error.getMessage()); /*Back to UI*/ } - }){ + }) { @Override protected Map getPostParams() throws AuthFailureError { - HashMap mapBody = new HashMap<>() ; - mapBody.put("email", email) ; - mapBody.put("authToken", authToken) ; - mapBody.put("data", codeData) ; - return mapBody ; + HashMap 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); @@ -247,7 +251,11 @@ public void onErrorResponse(VolleyError error) { }) { @Override protected Map getParams() throws AuthFailureError { - return APIContract.getSpeakersParams(email, auth_token); + if (!isGuest) + return APIContract.getSpeakersParams(email, auth_token); + else { + return APIContract.getGuestParams(); + } } }; @@ -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); @@ -338,7 +346,10 @@ public void onErrorResponse(VolleyError error) { }) { @Override protected Map getParams() throws AuthFailureError { - return APIContract.getFAQParams(email, auth_token); + if (!isGuest) + return APIContract.getFAQParams(email, auth_token); + else + return APIContract.getGuestParams(); } }; @@ -438,7 +449,7 @@ protected Map 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); @@ -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 apiList = CustomTypeAdapter.typeRealmString().fromJson(response, new TypeToken>(){}.getType()); + if (validateResponse("{ " + "\"response\"" + ":" + response + "}")) { + List apiList = CustomTypeAdapter.typeRealmString().fromJson(response, new TypeToken>() { + }.getType()); mServerAuthenticateListener.onRequestCompleted(ALL_APIS_CODE, apiList); } else { mServerAuthenticateListener.onRequestError(ALL_APIS_CODE, ErrorDefinitions.getMessage(ErrorDefinitions.CODE_WRONG_FORMAT)); @@ -509,7 +521,7 @@ public void onErrorResponse(VolleyError error) { }) { @Override protected Map getParams() throws AuthFailureError { - return APIContract.getSlotParams(email, auth_token,isWinner, slots); + return APIContract.getSlotParams(email, auth_token, isWinner, slots); } }; diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Control/Algorithms/TimelineAlgos.java b/app/src/main/java/com/gdgvitvellore/devfest/Control/Algorithms/TimelineAlgos.java index f1f3787..8416b72 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Control/Algorithms/TimelineAlgos.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Control/Algorithms/TimelineAlgos.java @@ -20,6 +20,7 @@ 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(":", ""); @@ -27,6 +28,7 @@ public static boolean calculateTime(String startTime, String endTime) { 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{ diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Control/Contracts/APIContract.java b/app/src/main/java/com/gdgvitvellore/devfest/Control/Contracts/APIContract.java index c13b9c5..4ffe308 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Control/Contracts/APIContract.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Control/Contracts/APIContract.java @@ -136,4 +136,10 @@ public static String getChatBotParams(String email, String question) { } return ""; } + + public static Map getGuestParams() { + Map map = new HashMap<>(); + map.put("isGuest", "true"); + return map; + } } diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Control/DataGenerator/AboutDataGenerator.java b/app/src/main/java/com/gdgvitvellore/devfest/Control/DataGenerator/AboutDataGenerator.java index 172d3f1..2b26de5 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Control/DataGenerator/AboutDataGenerator.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Control/DataGenerator/AboutDataGenerator.java @@ -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; @@ -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+"); @@ -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("gdgvitvellore@gmail.com"); + child4.setDesignation("mailto:gdgvitvellore@gmail.com"); 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); diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/About/Fragments/AboutFragment.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/About/Fragments/AboutFragment.java index 79b9c94..d22ce91 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/About/Fragments/AboutFragment.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/About/Fragments/AboutFragment.java @@ -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; @@ -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; @@ -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(); + } } } @@ -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); } } @@ -257,9 +265,11 @@ 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); @@ -267,7 +277,7 @@ public ItemViewHolder(View itemView) { } 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()); @@ -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); + } + + } + } + }); } } } diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Admin/Fragment/FragmentAdminControls.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Admin/Fragment/FragmentAdminControls.java deleted file mode 100644 index d9fd916..0000000 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Admin/Fragment/FragmentAdminControls.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.gdgvitvellore.devfest.Entity.Admin.Fragment; - -import android.graphics.PointF; -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; - -//import com.dlazaro66.qrcodereaderview.QRCodeReaderView; -import com.gdgvitvellore.devfest.gdgdevfest.R; - -import org.json.JSONException; -import org.json.JSONObject; - - -public class FragmentAdminControls extends Fragment/* implements QRCodeReaderView.OnQRCodeReadListener, View.OnClickListener*/{ - - private static final String TAG = "TAG"; - private Button btnStartStop ; - private TextView tvJsonView ; - //private QRCodeReaderView qrCodeReaderView ; - private Boolean isCameraActive = false ; - - @Nullable - @Override - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - return inflater.inflate(R.layout.fragment_admin, container, false) ; - } - - @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - - btnStartStop = (Button) view.findViewById(R.id.fragment_admin_btn_qr_start_stop) ; - tvJsonView = (TextView) view.findViewById(R.id.fragment_admin_tv_json) ; - //qrCodeReaderView = (QRCodeReaderView) view.findViewById(R.id.fragment_admin_qrcodereader_view) ; - init() ; - } - - private void init() { - /*qrCodeReaderView.setOnQRCodeReadListener(this); - qrCodeReaderView.setQRDecodingEnabled(true) ; - qrCodeReaderView.setAutofocusInterval(2000L); - - qrCodeReaderView.setTorchEnabled(false); - - qrCodeReaderView.setBackCamera();*/ - } - - /*@Override - public void onQRCodeRead(String text, PointF[] points) { - Log.i(TAG, "onQRCodeRead: " + text); - - tvJsonView.setText(text); - try { - JSONObject qrJson = new JSONObject(text) ; - String emailId = qrJson.getString("emailID") ; - String data = qrJson.getString("data") ; - - *//** - * Make API function call - * @ConnectAPI.java#qrCodeScan method line number 185 - * *//* - - } catch (JSONException e) { - e.printStackTrace(); - } - } - - @Override - public void onClick(View view) { - if(view.getId() == R.id.fragment_admin_btn_qr_start_stop){ - if(isCameraActive){ - btnStartStop.setText("Start Decoding"); - qrCodeReaderView.setQRDecodingEnabled(false); - }else { - btnStartStop.setText("Stop Decoding"); - qrCodeReaderView.setQRDecodingEnabled(true); - } - isCameraActive = !isCameraActive ; - } - }*/ -} diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Authentication/Activities/AuthenticationActivity.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Authentication/Activities/AuthenticationActivity.java index 90446cb..d449150 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Authentication/Activities/AuthenticationActivity.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Authentication/Activities/AuthenticationActivity.java @@ -85,7 +85,7 @@ private void setInit() { @Override public void onGlobalLayout() { - Animator reveal=BackgroundCircularReveal.circularRevealSplash(bgSplash, 0, 0); + Animator reveal = BackgroundCircularReveal.circularRevealSplash(bgSplash, 0, 0); reveal.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { @@ -109,7 +109,7 @@ public void onAnimationRepeat(Animator animation) { }); reveal.start(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - bgSplash.getViewTreeObserver().removeGlobalOnLayoutListener(this); + bgSplash.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { bgSplash.getViewTreeObserver().removeOnGlobalLayoutListener(this); } @@ -143,21 +143,23 @@ public void onRequestInitiated(int code) { public void onRequestCompleted(int code, Object result) { if (code == ConnectAPI.LOGIN_CODE) { - LoginResult loginResult=(LoginResult)result; - Log.d("LOGIN RESPONSE",result.toString()); - if(loginResult!=null){ - if (loginResult.getStatus()== ErrorDefinitions.CODE_SUCCESS){ - Log.d("LOGIN","SUCCESS"); + LoginResult loginResult = (LoginResult) result; + Log.d("LOGIN RESPONSE", result.toString()); + if (loginResult != null) { + if (loginResult.getStatus() == ErrorDefinitions.CODE_SUCCESS) { + Log.d("LOGIN", "SUCCESS"); DataHandler.getInstance(this).saveUser(loginResult.getUser()); DataHandler.getInstance(this).saveTeam(loginResult.getTeam()); DataHandler.getInstance(this).saveSlotLastUsed(loginResult.getUser().getSlotLastTime()); - Intent intent=new Intent(this, MainActivity.class); + Intent intent = new Intent(this, MainActivity.class); intent.putExtra("status", Status.LOGGED_IN); startActivity(intent); DataHandler.getInstance(this).saveLoggedIn(true); finish(); - }else{ + } else { showMessage(ErrorDefinitions.getMessage(loginResult.getStatus())); + signin.setText("Sign in"); + signin.setClickable(true); } } } @@ -204,7 +206,7 @@ public void onClick(View v) { } private void guestLogin() { - Intent intent=new Intent(this, MainActivity.class); + Intent intent = new Intent(this, MainActivity.class); intent.putExtra("status", Status.GUEST_USER); startActivity(intent); finish(); @@ -215,7 +217,7 @@ private void login() { getCredentials(); disable(); try { - connectAPI.login(emailInput,passInput); + connectAPI.login(emailInput, passInput); } catch (BindingException e) { e.printStackTrace(); } @@ -229,9 +231,8 @@ private void disable() { @Override public void showMessage(String message) { - Snackbar.make(bgSplash,message,Snackbar.LENGTH_SHORT).show(); - signin.setText("Sign in"); - signin.setClickable(true); + Snackbar.make(bgSplash, message, Snackbar.LENGTH_SHORT).show(); + } @Override diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/FAQ/Fragments/FAQFragment.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/FAQ/Fragments/FAQFragment.java index b903c6f..7089007 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/FAQ/Fragments/FAQFragment.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/FAQ/Fragments/FAQFragment.java @@ -41,6 +41,7 @@ import com.gdgvitvellore.devfest.Entity.Actors.ChatbotResult; import com.gdgvitvellore.devfest.Entity.Actors.FAQ; import com.gdgvitvellore.devfest.Entity.Actors.FAQResult; +import com.gdgvitvellore.devfest.Entity.Main.Activities.MainActivity; import com.gdgvitvellore.devfest.gdgdevfest.R; import java.io.UnsupportedEncodingException; @@ -52,7 +53,6 @@ public class FAQFragment extends Fragment implements RecognitionListener, View.OnClickListener, ConnectAPI.ServerAuthenticateListener, ViewUtils { private static final String TAG = FAQFragment.class.getSimpleName(); - private static final int REQUEST_AUDIO_PERMS = 1; private List faqList; @@ -74,6 +74,7 @@ public class FAQFragment extends Fragment implements public String[] AUDIO_PERMS = { Manifest.permission.RECORD_AUDIO, }; + private String email,auth; private FaqFragmentManager fragmentManager; @@ -103,6 +104,11 @@ private void init(View rootView) { fragmentManager = new FaqFragmentManager(); recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + if(!MainActivity.ISGUEST){ + email=DataHandler.getInstance(getContext()).getUser().getEmail(); + auth=DataHandler.getInstance(getContext()).getUser().getAuthToken(); + } + } private void setInit() { @@ -118,10 +124,12 @@ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { if (charSequence.length() > 0) { stateId = 201; + voiceFab.setImageResource(R.drawable.ic_done); //change button } else { stateId = 101; //set it back to microphone + voiceFab.setImageResource(R.drawable.ic_mic_black_24px); } } @@ -156,11 +164,11 @@ public void onInit(int i) { private void setData() { faqList = DataHandler.getInstance(getContext()).getFAQ(); - if (faqList != null&&faqList.size()>0) { + if (faqList != null && faqList.size() > 0) { faqExpandableAdapter = new FAQExpandableAdapter(getContext(), faqList); rvExpanded.setAdapter(faqExpandableAdapter); - }else{ - connectAPI.faq(DataHandler.getInstance(getContext()).getUser().getEmail(), DataHandler.getInstance(getContext()).getUser().getAuthToken()); + } else { + connectAPI.faq(email, auth, MainActivity.ISGUEST); } } @@ -173,17 +181,17 @@ public void onStart() { @Override public void onReadyForSpeech(Bundle bundle) { - + Log.i(TAG, "onReadyForSpeech: "); } @Override public void onBeginningOfSpeech() { - + Log.i(TAG, "onBeginningOfSpeech: "); } @Override public void onRmsChanged(float v) { - + Log.i(TAG, "onRmsChanged: "); } @Override @@ -197,12 +205,12 @@ public void onBufferReceived(byte[] bytes) { @Override public void onEndOfSpeech() { - + Log.i(TAG, "onEndOfSpeech: "); } @Override public void onError(int i) { - + Log.i(TAG, "onError: " + i); } @Override @@ -215,7 +223,6 @@ public void onResults(Bundle bundle) { /*TODO: Select the best text and make network call*/ etQuestion.setText(matches.get(0)); - } public void displayChatbotResponse(ChatbotResult chatbotResult) { @@ -242,7 +249,7 @@ public void onClick(DialogInterface dialog, int which) { dialogFailure.setCancelable(false); dialogFailure.setTitle("Error"); dialogFailure.setMessage("Sorry we couldn't really get the answer for you."); - dialogFailure.setButton(DialogInterface.BUTTON_POSITIVE,"Try Again!", new DialogInterface.OnClickListener() { + dialogFailure.setButton(DialogInterface.BUTTON_POSITIVE, "Try Again!", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); @@ -296,18 +303,20 @@ public void onClick(View v) { if (!isOn || speechRecognizer != null) { Log.i(TAG, "onClick: IS ON NOW"); speechRecognizer.startListening(recognizerIntent); + voiceFab.setImageResource(R.drawable.ic_record_voice_over); } else { Log.i(TAG, "onClick: IS OFF NOW"); assert speechRecognizer != null; speechRecognizer.stopListening(); + voiceFab.setImageResource(R.drawable.ic_mic_black_24px); } isOn = !isOn; } } else if (stateId == 201) { try { - connectAPI.chatBot(DataHandler.getInstance(getContext()).getUser().getEmail(), etQuestion.getText().toString()); + connectAPI.chatBot(email, etQuestion.getText().toString()); } catch (BindingException e) { e.printStackTrace(); } @@ -390,9 +399,9 @@ public void onRequestCompleted(int code, Object result) { showMessage(faqresult.getMessage()); } } - }else if(code==ConnectAPI.CHATBOT_CODE){ - ChatbotResult chatbotResult=(ChatbotResult)result; - if(chatbotResult!=null) { + } else if (code == ConnectAPI.CHATBOT_CODE) { + ChatbotResult chatbotResult = (ChatbotResult) result; + if (chatbotResult != null) { if (chatbotResult.getStatus() == ErrorDefinitions.CODE_SUCCESS) { displayChatbotResponse(chatbotResult); } diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Main/Activities/MainActivity.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Main/Activities/MainActivity.java index 1d4c5b6..da0d834 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Main/Activities/MainActivity.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Main/Activities/MainActivity.java @@ -14,17 +14,18 @@ import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import android.widget.Toast; import com.gdgvitvellore.devfest.Boundary.Handlers.DataHandler; import com.gdgvitvellore.devfest.Control.Animations.Main.DrawerCircularReveal; import com.gdgvitvellore.devfest.Control.Animations.Main.ObjectAnimations; +import com.gdgvitvellore.devfest.Control.Contracts.Status; import com.gdgvitvellore.devfest.Control.Utils.ViewUtils; import com.gdgvitvellore.devfest.Entity.About.Fragments.AboutFragment; import com.gdgvitvellore.devfest.Entity.Actors.DrawerItem; @@ -43,22 +44,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListener, ViewUtils { private static final String TAG = MainActivity.class.getSimpleName(); + public static boolean ISGUEST = false; private Toolbar toolbar; private TextView titleView; private RecyclerView drawerRecycler; private LinearLayout drawer, drawerTrigger; private LinearLayout fragmentHolder; - private ImageView arrowIcon; + private ImageView arrowIcon; private DrawerAdapter drawerAdapter; private LinearLayoutManager linearLayoutManager; - private boolean isDrawerOpened = false; + private boolean isDrawerOpened = false; private List drawerItems; private int lastFragmentSelected = -1; private String[] toolbarTitles; - private int ISGUEST = 0; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -84,10 +85,10 @@ private void init() { if (getIntent().hasExtra("status")) { - if (getIntent().getStringExtra("status").equals("Welcome Guest")) { - ISGUEST = 1; + if (getIntent().getStringExtra("status").equals(Status.GUEST_USER)) { + Log.i(TAG, "init: guest"); + ISGUEST = true; } - // showMessage(getIntent().getStringExtra("status")); } } @@ -98,7 +99,7 @@ private void setInit() { drawerTrigger.setOnClickListener(this); TypedArray drawerIcons; - if (ISGUEST != 1) { + if (!ISGUEST) { drawerIcons = getResources().obtainTypedArray(R.array.drawer_icons); toolbarTitles = getResources().getStringArray(R.array.drawer_titles); @@ -107,7 +108,6 @@ private void setInit() { toolbarTitles = getResources().getStringArray(R.array.drawer_titles_guest); } for (int i = 0; i < toolbarTitles.length; i++) { - //TODO To change the default icon later drawerItems.add(new DrawerItem(toolbarTitles[i], drawerIcons.getResourceId(i, R.drawable.ic_default))); } } @@ -128,51 +128,79 @@ private void setFragment(int i) { FragmentManager manager = getSupportFragmentManager(); if (i == lastFragmentSelected) { - toggle(); return; } else { - switch (i) { - case 0: - Fragment timelineFragment = new TimelineFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, timelineFragment, TimelineFragment.class.getSimpleName()).commit(); - break; - case 1: - Fragment myTeamFragment = new MyTeamFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, myTeamFragment, MyTeamFragment.class.getSimpleName()).commit(); - break; - case 2: - Fragment slotMachineFragment = new SlotMachineFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, slotMachineFragment, SlotMachineFragment.class.getSimpleName()).commit(); - break; - case 3: - Fragment couponsFragment = new CouponsFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, couponsFragment, CouponsFragment.class.getSimpleName()).commit(); - break; - case 4: - Fragment faqFragment = new FAQFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, faqFragment, FAQFragment.class.getSimpleName()).commit(); - break; - case 5: - Fragment aboutFragment = new AboutFragment(); - manager.beginTransaction().replace(R.id.fragment_holder, aboutFragment, AboutFragment.class.getSimpleName()).commit(); - break; - case 6: - DataHandler.getInstance(this).logout(); - DataHandler.getInstance(this).saveLoggedIn(false); - startActivity(new Intent(MainActivity.this, AuthenticationActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - break; - default: - break; + lastFragmentSelected = i; + if (ISGUEST) { + switch (i) { + case 0: + Fragment timelineFragment = new TimelineFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, timelineFragment, TimelineFragment.class.getSimpleName()).commit(); + break; + case 1: + Fragment slotMachineFragment = new SlotMachineFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, slotMachineFragment, SlotMachineFragment.class.getSimpleName()).commit(); + break; + case 2: + Fragment faqFragment = new FAQFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, faqFragment, FAQFragment.class.getSimpleName()).commit(); + break; + case 3: + Fragment aboutFragment = new AboutFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, aboutFragment, AboutFragment.class.getSimpleName()).commit(); + break; + case 4: + startActivity(new Intent(MainActivity.this, AuthenticationActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + finish(); + break; + default: + break; + } + } else { + switch (i) { + case 0: + Fragment timelineFragment = new TimelineFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, timelineFragment, TimelineFragment.class.getSimpleName()).commit(); + break; + case 1: + Fragment myTeamFragment = new MyTeamFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, myTeamFragment, MyTeamFragment.class.getSimpleName()).commit(); + break; + case 2: + Fragment slotMachineFragment = new SlotMachineFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, slotMachineFragment, SlotMachineFragment.class.getSimpleName()).commit(); + break; + case 3: + Fragment couponsFragment = new CouponsFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, couponsFragment, CouponsFragment.class.getSimpleName()).commit(); + break; + case 4: + Fragment faqFragment = new FAQFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, faqFragment, FAQFragment.class.getSimpleName()).commit(); + break; + case 5: + Fragment aboutFragment = new AboutFragment(); + manager.beginTransaction().replace(R.id.fragment_holder, aboutFragment, AboutFragment.class.getSimpleName()).commit(); + break; + case 6: + DataHandler.getInstance(this).logout(); + DataHandler.getInstance(this).saveLoggedIn(false); + startActivity(new Intent(MainActivity.this, AuthenticationActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + finish(); + break; + default: + break; + } } } } - private void setToolbarTitle(int position) { + public void setToolbarTitle(int position) { titleView.setText(toolbarTitles[position]); } - private void toggle() { + private void toggleDrawer() { if (isDrawerOpened) { if (Build.VERSION.SDK_INT >= 21) { @@ -224,7 +252,7 @@ public void onAnimationRepeat(Animator animation) { public void onClick(View v) { switch (v.getId()) { case R.id.drawer_trigger: - toggle(); + toggleDrawer(); } } @@ -295,11 +323,16 @@ public DrawerViewHolder(View itemView) { @Override public void onClick(View v) { - toggle(); + toggleDrawer(); setFragment(getAdapterPosition()); setToolbarTitle(getAdapterPosition()); } } } + @Override + protected void onDestroy() { + super.onDestroy(); + MainActivity.ISGUEST=false; + } } diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/SlotMachine/Fragments/SlotMachineFragment.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/SlotMachine/Fragments/SlotMachineFragment.java index faadf38..7b17be9 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/SlotMachine/Fragments/SlotMachineFragment.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/SlotMachine/Fragments/SlotMachineFragment.java @@ -39,6 +39,7 @@ import com.gdgvitvellore.devfest.Entity.Actors.SlotsResult; 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; @@ -55,9 +56,9 @@ public class SlotMachineFragment extends Fragment implements View.OnTouchListene private ImageView trigger; private ImageView slot1, slot2, slot3; - private LinearLayout triggerHolder, arrowLayout,apiNamesHolder; + private LinearLayout triggerHolder, arrowLayout, apiNamesHolder; private DigitalClockView digitalClockView; - private TextView apiName1,apiName2,apiName3; + private TextView apiName1, apiName2, apiName3; private FrameLayout root; private ProgressDialog progressDialog; @@ -95,19 +96,20 @@ private void init(View rootView) { root = (FrameLayout) rootView.findViewById(R.id.root); progressDialog = new ProgressDialog(getContext()); - apiNamesHolder=(LinearLayout)rootView.findViewById(R.id.api_names_holder); - apiName1=(TextView)rootView.findViewById(R.id.api_name_1); - apiName2=(TextView)rootView.findViewById(R.id.api_name_2); - apiName3=(TextView)rootView.findViewById(R.id.api_name_3); + apiNamesHolder = (LinearLayout) rootView.findViewById(R.id.api_names_holder); + apiName1 = (TextView) rootView.findViewById(R.id.api_name_1); + apiName2 = (TextView) rootView.findViewById(R.id.api_name_2); + apiName3 = (TextView) rootView.findViewById(R.id.api_name_3); digitalClockView = (DigitalClockView) rootView.findViewById(R.id.digitalClock); - user = DataHandler.getInstance(getContext()).getUser(); - if (user == null) { - startActivity(new Intent(getActivity(), AuthenticationActivity.class)); - getActivity().finish(); - } - + if (!MainActivity.ISGUEST) { + user = DataHandler.getInstance(getContext()).getUser(); + if (user == null) { + startActivity(new Intent(getActivity(), AuthenticationActivity.class)); + getActivity().finish(); + } + } connectAPI = new ConnectAPI(getContext()); } @@ -132,16 +134,20 @@ private void setInit() { private void setData() { apiList = DataHandler.getInstance(getContext()).getAllApis(); + if (apiList != null && apiList.size() > 0) { prepareBitmaps(); if (!(System.currentTimeMillis() - DataHandler.getInstance(getContext()).getSlotLastUsed() > PrivateContract.SLOT_WAIT_TIME)) { trigger.setEnabled(false); startWaitTimer(PrivateContract.SLOT_WAIT_TIME - (System.currentTimeMillis() - DataHandler.getInstance(getContext()).getSlotLastUsed())); - }else { + } else { trigger.setEnabled(true); } } else { - connectAPI.allApis(user.getEmail(), user.getAuthToken()); + if (!MainActivity.ISGUEST) + connectAPI.allApis(user.getEmail(), user.getAuthToken(), false); + else + connectAPI.allApis(null, null, true); } } @@ -205,7 +211,8 @@ public void onTick(long l) { public void onFinish() { startWaitTimer(PrivateContract.SLOT_WAIT_TIME); DataHandler.getInstance(getContext()).saveSlotLastUsed(System.currentTimeMillis()); - connectAPI.slots(user.getEmail(), user.getAuthToken(), i == j + 1 && j + 1 == k + 1 ? true : false, "" + i + j + k); + if (!MainActivity.ISGUEST) + connectAPI.slots(user.getEmail(), user.getAuthToken(), i == j + 1 && j + 1 == k + 1 ? true : false, "" + i + j + k); Log.i(TAG, "onFinish: " + i + ":" + j + ":" + k); apiName1.setText(apiList.get(i).getName()); apiName2.setText(apiList.get(j).getName()); @@ -261,6 +268,13 @@ public boolean onTouch(View v, MotionEvent event) { int eid = event.getAction(); switch (eid) { + case MotionEvent.ACTION_DOWN: + ObjectAnimations.fadeOutAnimation(apiNamesHolder).start(); + ObjectAnimations.fadeOutAnimation(arrowLayout).start(); + downPT.x = event.getX(); + downPT.y = event.getY(); + startPT = new PointF(trigger.getX(), trigger.getY()); + break; case MotionEvent.ACTION_MOVE: PointF mv = new PointF(event.getX() - downPT.x, event.getY() - downPT.y); Rect rec = new Rect(); @@ -272,13 +286,6 @@ public boolean onTouch(View v, MotionEvent event) { startPT = new PointF(trigger.getX(), trigger.getY()); } break; - case MotionEvent.ACTION_DOWN: - ObjectAnimations.fadeOutAnimation(apiNamesHolder).start(); - ObjectAnimations.fadeOutAnimation(arrowLayout).start(); - downPT.x = event.getX(); - downPT.y = event.getY(); - startPT = new PointF(trigger.getX(), trigger.getY()); - break; case MotionEvent.ACTION_UP: Animator animator = ObjectAnimations.flickerAnimation(trigger); animator.addListener(new Animator.AnimatorListener() { @@ -318,7 +325,7 @@ public void onResume() { super.onResume(); if (NetworkUtils.hasConnectivity(getContext()) && !digitalClockView.isMorphingAnimationRunning()) { trigger.setEnabled(true); - } else if (!digitalClockView.isMorphingAnimationRunning()) { + } else { trigger.setEnabled(false); showMessage("Connect to internet"); } @@ -354,15 +361,9 @@ public void onRequestCompleted(int code, Object result) { } private void startDownloadingImages(List result) { - progressDialog.cancel(); - progressDialog = new ProgressDialog(getContext()); - progressDialog.setMessage("Loading Slots..."); - progressDialog.setCancelable(false); - progressDialog.setMax(100); - progressDialog.setIndeterminate(false); - progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); - progressDialog.show(); apiList = result; + showDownloadProgress(); + Intent intent = new Intent(getActivity(), ImageDownloadService.class); String[] links = new String[result.size()]; for (int i = 0; i < result.size(); i++) { @@ -373,6 +374,17 @@ private void startDownloadingImages(List result) { getActivity().startService(intent); } + private void showDownloadProgress() { + progressDialog.cancel(); + progressDialog = new ProgressDialog(getContext()); + progressDialog.setMessage("Loading Slots..."); + progressDialog.setCancelable(false); + progressDialog.setMax(100); + progressDialog.setIndeterminate(false); + progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + progressDialog.show(); + } + @Override public void onRequestError(int code, String message) { if (code == ConnectAPI.ALL_APIS_CODE) { @@ -389,8 +401,8 @@ public void showMessage(String message) { } @Override - public void showMessage(String message,boolean showRetry) { - if(showRetry){ + public void showMessage(String message, boolean showRetry) { + if (showRetry) { Snackbar.make(root, message, Snackbar.LENGTH_SHORT).setAction("Retry", new View.OnClickListener() { @Override @@ -398,7 +410,7 @@ public void onClick(View v) { startDownloadingImages(apiList); } }).show(); - }else{ + } else { Snackbar.make(root, message, Snackbar.LENGTH_SHORT).show(); } } @@ -433,7 +445,7 @@ protected void onReceiveResult(int resultCode, Bundle resultData) { setData(); } } else { - showMessage("Error loading",true); + showMessage("Error loading", true); apiList = new ArrayList<>(); progressDialog.cancel(); trigger.setEnabled(false); diff --git a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Timeline/Fragments/TimelineFragment.java b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Timeline/Fragments/TimelineFragment.java index a2e8709..004075f 100644 --- a/app/src/main/java/com/gdgvitvellore/devfest/Entity/Timeline/Fragments/TimelineFragment.java +++ b/app/src/main/java/com/gdgvitvellore/devfest/Entity/Timeline/Fragments/TimelineFragment.java @@ -1,9 +1,9 @@ package com.gdgvitvellore.devfest.Entity.Timeline.Fragments; +import android.animation.ObjectAnimator; import android.app.ProgressDialog; import android.os.Bundle; -import android.os.CountDownTimer; import android.os.Handler; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; @@ -32,13 +32,13 @@ import com.gdgvitvellore.devfest.Entity.Customs.EmptyFragment; import com.gdgvitvellore.devfest.Entity.Customs.VerticalPageTransformer; import com.gdgvitvellore.devfest.Entity.Customs.VerticalViewPager; +import com.gdgvitvellore.devfest.Entity.Main.Activities.MainActivity; import com.gdgvitvellore.devfest.gdgdevfest.R; import java.util.ArrayList; import java.util.List; - /** * Created by Prince Bansal Local on 10/10/2016. */ @@ -48,24 +48,24 @@ public class TimelineFragment extends Fragment implements ConnectAPI.ServerAuthe private static final int NUM_PAGES = 2; private static final String TAG = TimelineFragment.class.getSimpleName(); - private VerticalViewPager viewPager; + private VerticalViewPager phaseDisplayPager; private RecyclerView recyclerView; private TextView timer, title; private ProgressDialog progressDialog; - private LinearLayout root; + private ImageView indicator1; + private ImageView indicator2; + private LinearLayout root; private TimelineDisplayFragment timelineDisplayFragment; - private TimelineAboutFragment timelineAboutFragment; + private TimelineAboutFragment timelineAboutFragment; private PhasesAdapter mAdapter; - private List phaseList = new ArrayList<>(); + private List phaseList = new ArrayList<>(); private Handler customHandler = new Handler(); private int hoursToGo = 24; private int minutesToGo = 0; private int secondsToGo = 0; - private ImageView indicator1; - private ImageView indicator2; private int millisToGo = secondsToGo * 1000 + minutesToGo * 1000 * 60 + hoursToGo * 1000 * 60 * 60; @@ -73,6 +73,7 @@ public class TimelineFragment extends Fragment implements ConnectAPI.ServerAuthe private String email, auth; private Phase currentPhase; + private ViewPagerAdapter phasePagerAdapter; @Nullable @@ -86,7 +87,6 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); init(view); - getCredentials(); setInit(); setData(); } @@ -96,114 +96,68 @@ private void init(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.phases_list); timer = (TextView) view.findViewById(R.id.time); title = (TextView) view.findViewById(R.id.title); - viewPager = (VerticalViewPager) view.findViewById(R.id.pager); + phaseDisplayPager = (VerticalViewPager) view.findViewById(R.id.pager); progressDialog = new ProgressDialog(getContext()); root = (LinearLayout) view.findViewById(R.id.root); timelineDisplayFragment = new TimelineDisplayFragment(); timelineAboutFragment = new TimelineAboutFragment(); - indicator1 = (ImageView)view.findViewById(R.id.indicator1); - indicator2 = (ImageView)view.findViewById(R.id.indicator2); + indicator1 = (ImageView) view.findViewById(R.id.indicator1); + indicator2 = (ImageView) view.findViewById(R.id.indicator2); connectAPI = new ConnectAPI(getActivity()); - } + phasePagerAdapter = new ViewPagerAdapter(getChildFragmentManager()); - private void getCredentials() { - email = DataHandler.getInstance(getActivity()).getUser().getEmail(); - Log.d("EMAIL", email); - auth = DataHandler.getInstance(getActivity()).getUser().getAuthToken(); - Log.d("PASSWORD", auth); + if (!MainActivity.ISGUEST) { + email = DataHandler.getInstance(getActivity()).getUser().getEmail(); + Log.d("EMAIL", email); + auth = DataHandler.getInstance(getActivity()).getUser().getAuthToken(); + Log.d("AUTH", auth); + } } private void setInit() { connectAPI.setServerAuthenticateListener(this); + LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext(), LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); - viewPager.setPageTransformer(false, new VerticalPageTransformer()); - - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - - } - @Override - public void onPageSelected(int position) { - - if(position==0) - { - indicator1.setImageResource(R.drawable.white_indicator_circle); - indicator2.setImageResource(R.drawable.white_alpha_indicator_circle); - } - else if(position==1) - { - indicator1.setImageResource(R.drawable.white_alpha_indicator_circle); - indicator2.setImageResource(R.drawable.white_indicator_circle); - } - - } - - @Override - public void onPageScrollStateChanged(int state) { - - } - }); - //startTimer(); + phaseDisplayPager.setPageTransformer(false, new VerticalPageTransformer()); + phaseDisplayPager.addOnPageChangeListener(this); } private void setData() { - setupViewPager(viewPager); - List phases = DataHandler.getInstance(getContext()).getPhases(); - if (phases != null) { - Log.i(TAG, "setData: "); - phaseList = phases; + + phaseList = DataHandler.getInstance(getContext()).getPhases(); + + if (phaseList != null) { mAdapter = new PhasesAdapter(phaseList); recyclerView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); - if (currentPhase != null) { - refreshCurrentEvent(); + phaseDisplayPager.setAdapter(phasePagerAdapter); + phaseDisplayPager.setCurrentItem(0); + if (phaseList.size() > 0) { + if (currentPhase != null) { + refreshCurrentEvent(0); + } else { + currentPhase = phaseList.get(0); + } } } else { - connectAPI.timeline(DataHandler.getInstance(getContext()).getUser().getEmail(), - DataHandler.getInstance(getContext()).getUser().getAuthToken()); + connectAPI.timeline(email, auth, MainActivity.ISGUEST); } } - private void refreshCurrentEvent() { + private void refreshCurrentEvent(int position) { title.setText(currentPhase.getTitle()); timer.setText(TimelineAlgos.getTime(currentPhase.getStartTime()) + " - " + TimelineAlgos.getTime(currentPhase.getEndTime())); - timelineAboutFragment.setTimelineAbout(currentPhase.getDescription()); - timelineDisplayFragment.setImage(currentPhase.getImageUrl()); - } - - private void setupViewPager(ViewPager viewPager) { - ViewPagerAdapter adapter = new ViewPagerAdapter(getChildFragmentManager()); - viewPager.addOnPageChangeListener(this); - viewPager.setAdapter(adapter); - } - - private void startTimer() { - new CountDownTimer(millisToGo, 1000) { - - @Override - public void onTick(long millis) { - int seconds = (int) (millis / 1000) % 60; - int minutes = (int) ((millis / (1000 * 60)) % 60); - int hours = (int) ((millis / (1000 * 60 * 60)) % 24); - String text = String.format("%02d H, %02d M, %02d S", hours, minutes, seconds); - timer.setText(text); - } - - @Override - public void onFinish() { - - //Start post Hackathon activity - - } - }; + if (position == 1) + timelineAboutFragment.setTimelineAbout(currentPhase.getDescription()); + else if (position == 0) + timelineDisplayFragment.setImage(currentPhase.getImageUrl()); } @Override @@ -263,15 +217,17 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse @Override public void onPageSelected(int position) { - if(position==0) { + if (position == 0) { + indicator1.setImageResource(R.drawable.white_indicator_circle); + indicator2.setImageResource(R.drawable.white_alpha_indicator_circle); if (currentPhase == null) { - currentPhase = phaseList.get(0); - timelineDisplayFragment.setImage(currentPhase.getImageUrl()); + refreshCurrentEvent(position); } - }else if(position==1){ - if (currentPhase == null) { - currentPhase = phaseList.get(0); - timelineDisplayFragment.setImage(currentPhase.getImageUrl()); + } else if (position == 1) { + indicator1.setImageResource(R.drawable.white_alpha_indicator_circle); + indicator2.setImageResource(R.drawable.white_indicator_circle); + if (currentPhase != null) { + refreshCurrentEvent(position); } } } @@ -307,7 +263,8 @@ public int getCount() { public class PhasesAdapter extends RecyclerView.Adapter { private List phasesList; - private Phase nowPhase; + private View lastViewClicked=null; + private int lastClicked=-1; public PhasesAdapter(List phasesList) { this.phasesList = phasesList; @@ -329,12 +286,12 @@ public void onBindViewHolder(MyViewHolder holder, int position) { holder.time.setText(TimelineAlgos.getTime(phase.getStartTime()) + "-" + TimelineAlgos.getTime(phase.getEndTime())); if (TimelineAlgos.calculateTime(phase.getStartTime(), phase.getEndTime())) { - Log.i(TAG, "onBindViewHolder: "+phase.getTitle()); + Log.i(TAG, "onBindViewHolder: " + phase.getTitle()); currentPhase = phase; - refreshCurrentEvent(); + refreshCurrentEvent(position); holder.time.setActivated(true); holder.time.setText("Now"); - }else{ + } else { holder.time.setActivated(false); } @@ -360,9 +317,39 @@ public MyViewHolder(View view) { public void onClick(View v) { //phaseList.get(getAdapterPosition()).setRunning(true); //notifyDataSetChanged(); - currentPhase=phaseList.get(getAdapterPosition()); + currentPhase = phaseList.get(getAdapterPosition()); notifyDataSetChanged(); - refreshCurrentEvent(); + refreshCurrentEvent(0); + + if(lastViewClicked==null) { + ObjectAnimator animator = ObjectAnimator.ofFloat(v, "scaleX", 1f, 1.1f); + ObjectAnimator animator2 = ObjectAnimator.ofFloat(v, "scaleY", 1f, 1.1f); + animator.setDuration(500); + animator2.setDuration(500); + animator.start(); + animator2.start(); + lastViewClicked=v; + }else if(lastViewClicked!=v){ + ObjectAnimator animator = ObjectAnimator.ofFloat(lastViewClicked, "scaleX", 1.1f, 1f); + ObjectAnimator animator2 = ObjectAnimator.ofFloat(lastViewClicked, "scaleY", 1.1f, 1f); + ObjectAnimator animator3 = ObjectAnimator.ofFloat(v, "scaleX", 1f, 1.1f); + ObjectAnimator animator4 = ObjectAnimator.ofFloat(v, "scaleY", 1f, 1.1f); + animator3.setDuration(500); + animator4.setDuration(500); + animator.start(); + animator2.start(); + animator3.start(); + animator4.start(); + lastViewClicked=v; + }else{ + ObjectAnimator animator = ObjectAnimator.ofFloat(v, "scaleX", 1.1f, 1f); + ObjectAnimator animator2 = ObjectAnimator.ofFloat(v, "scaleY", 1.1f, 1f); + animator.setDuration(500); + animator2.setDuration(500); + animator.start(); + animator2.start(); + lastViewClicked=null; + } } } diff --git a/app/src/main/res/drawable/buttonbackground.xml b/app/src/main/res/drawable/buttonbackground.xml deleted file mode 100644 index ca56c05..0000000 --- a/app/src/main/res/drawable/buttonbackground.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/github_api.png b/app/src/main/res/drawable/github_api.png deleted file mode 100644 index 9c39f9c..0000000 Binary files a/app/src/main/res/drawable/github_api.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_arrow_drop_down_white_24px.xml b/app/src/main/res/drawable/ic_arrow_drop_down_white_24px.xml deleted file mode 100644 index 4ca346d..0000000 --- a/app/src/main/res/drawable/ic_arrow_drop_down_white_24px.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_brightness_4_black_24dp.xml b/app/src/main/res/drawable/ic_brightness_4_black_24dp.xml deleted file mode 100644 index bc3cdec..0000000 --- a/app/src/main/res/drawable/ic_brightness_4_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_do_not_disturb_alt_black_24dp.xml b/app/src/main/res/drawable/ic_do_not_disturb_alt_black_24dp.xml deleted file mode 100644 index f0ad05d..0000000 --- a/app/src/main/res/drawable/ic_do_not_disturb_alt_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_done.xml b/app/src/main/res/drawable/ic_done.xml new file mode 100644 index 0000000..964b80e --- /dev/null +++ b/app/src/main/res/drawable/ic_done.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_edu.xml b/app/src/main/res/drawable/ic_edu.xml deleted file mode 100644 index 86901f3..0000000 --- a/app/src/main/res/drawable/ic_edu.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_gbutton.xml b/app/src/main/res/drawable/ic_gbutton.xml deleted file mode 100644 index 914d0bb..0000000 --- a/app/src/main/res/drawable/ic_gbutton.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml deleted file mode 100644 index cbac220..0000000 --- a/app/src/main/res/drawable/ic_github.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_google.xml b/app/src/main/res/drawable/ic_google.xml deleted file mode 100644 index d398277..0000000 --- a/app/src/main/res/drawable/ic_google.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/drawable/ic_maps.xml b/app/src/main/res/drawable/ic_maps.xml deleted file mode 100644 index f097a3f..0000000 --- a/app/src/main/res/drawable/ic_maps.xml +++ /dev/null @@ -1,1488 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_mic_white_24px.xml b/app/src/main/res/drawable/ic_mic_white_24px.xml deleted file mode 100644 index d89b0f7..0000000 --- a/app/src/main/res/drawable/ic_mic_white_24px.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_qrcode.xml b/app/src/main/res/drawable/ic_qrcode.xml deleted file mode 100644 index 0e64a0d..0000000 --- a/app/src/main/res/drawable/ic_qrcode.xml +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_record_voice_over.xml b/app/src/main/res/drawable/ic_record_voice_over.xml new file mode 100644 index 0000000..1937fb3 --- /dev/null +++ b/app/src/main/res/drawable/ic_record_voice_over.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/img_speaker_three.jpg b/app/src/main/res/drawable/img_speaker_three.jpg deleted file mode 100644 index 5a7bea8..0000000 Binary files a/app/src/main/res/drawable/img_speaker_three.jpg and /dev/null differ diff --git a/app/src/main/res/drawable/img_speaker_two.jpg b/app/src/main/res/drawable/img_speaker_two.jpg deleted file mode 100644 index 934f667..0000000 Binary files a/app/src/main/res/drawable/img_speaker_two.jpg and /dev/null differ diff --git a/app/src/main/res/drawable/uber_api.png b/app/src/main/res/drawable/uber_api.png deleted file mode 100644 index 93db344..0000000 Binary files a/app/src/main/res/drawable/uber_api.png and /dev/null differ diff --git a/app/src/main/res/drawable/uber_api_150.png b/app/src/main/res/drawable/uber_api_150.png deleted file mode 100644 index d9f9490..0000000 Binary files a/app/src/main/res/drawable/uber_api_150.png and /dev/null differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index d6ab8a1..959eedc 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -115,7 +115,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/activity_vertical_margin_24dp" - android:visibility="invisible" android:text="@string/GuestContinue" android:textColor="@color/text_hint" /> diff --git a/app/src/main/res/layout/fragment_about_group_item.xml b/app/src/main/res/layout/fragment_about_group_item.xml index a8d5d76..e8cbc3c 100644 --- a/app/src/main/res/layout/fragment_about_group_item.xml +++ b/app/src/main/res/layout/fragment_about_group_item.xml @@ -5,13 +5,14 @@ xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/white" + android:background="?attr/selectableItemBackground" android:orientation="vertical"> + android:layout_height="wrap_content" + android:background="@color/white"> diff --git a/app/src/main/res/layout/fragment_slot_machine.xml b/app/src/main/res/layout/fragment_slot_machine.xml index e597ec2..9769b46 100644 --- a/app/src/main/res/layout/fragment_slot_machine.xml +++ b/app/src/main/res/layout/fragment_slot_machine.xml @@ -5,7 +5,7 @@ android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#272739" + android:background="@color/window_bg" tools:context="com.gdgvitvellore.devfest.Entity.SlotMachine.Fragments.SlotMachineFragment"> + android:layout_gravity="center"> + app:srcCompat="@mipmap/ic_launcher" /> diff --git a/app/src/main/res/layout/fragment_timeline_about.xml b/app/src/main/res/layout/fragment_timeline_about.xml index 5bdab02..10b6f09 100644 --- a/app/src/main/res/layout/fragment_timeline_about.xml +++ b/app/src/main/res/layout/fragment_timeline_about.xml @@ -18,6 +18,6 @@ android:id="@+id/timeline_about" android:textColor="@color/white" android:layout_marginTop="@dimen/activity_vertical_margin_24dp" - android:textSize="12sp" /> + android:textSize="17sp" /> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0c686e2..47a3318 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -25,5 +25,6 @@ #FFFFFF #212121 #757575 + #64dd17 diff --git a/library/build/intermediates/bundles/debug/classes.jar b/library/build/intermediates/bundles/debug/classes.jar new file mode 100644 index 0000000..b17e5a6 Binary files /dev/null and b/library/build/intermediates/bundles/debug/classes.jar differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/ArrayHelper.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/ArrayHelper.class new file mode 100644 index 0000000..d6d0617 Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/ArrayHelper.class differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/BuildConfig.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/BuildConfig.class new file mode 100644 index 0000000..7d2dc88 Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/BuildConfig.class differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/DigitalClockView.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/DigitalClockView.class new file mode 100644 index 0000000..1fa6e7a Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/DigitalClockView.class differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/DrawingHelper.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/DrawingHelper.class new file mode 100644 index 0000000..496d766 Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/DrawingHelper.class differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/Font.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/Font.class new file mode 100644 index 0000000..8cc1b45 Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/Font.class differ diff --git a/library/build/intermediates/classes/debug/com/bydavy/morpher/font/DFont.class b/library/build/intermediates/classes/debug/com/bydavy/morpher/font/DFont.class new file mode 100644 index 0000000..b6b99ce Binary files /dev/null and b/library/build/intermediates/classes/debug/com/bydavy/morpher/font/DFont.class differ diff --git a/library/build/intermediates/incremental-safeguard/debug/tag.txt b/library/build/intermediates/incremental-safeguard/debug/tag.txt new file mode 100644 index 0000000..c01a13d --- /dev/null +++ b/library/build/intermediates/incremental-safeguard/debug/tag.txt @@ -0,0 +1 @@ +incremental task execution \ No newline at end of file diff --git a/library/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml b/library/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml new file mode 100644 index 0000000..3ff2da7 --- /dev/null +++ b/library/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/library/build/outputs/aar/library-debug.aar b/library/build/outputs/aar/library-debug.aar index f48a1c6..db145b1 100644 Binary files a/library/build/outputs/aar/library-debug.aar and b/library/build/outputs/aar/library-debug.aar differ