diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfe0770
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3270997
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,83 @@
+# Built application files
+*.apk
+*.ap_
+*.aab
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+release/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# IntelliJ
+*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/gradle.xml
+.idea/assetWizardSettings.xml
+.idea/dictionaries
+.idea/libraries
+# Android Studio 3 in .gitignore file.
+.idea/caches
+.idea/modules.xml
+# Comment next line if keeping position of elements in Navigation Editor is relevant for you
+.idea/navEditor.xml
+
+# Keystore files
+# Uncomment the following lines if you do not want to check your keystore files in.
+#*.jks
+#*.keystore
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# Google Services (e.g. APIs or Firebase)
+# google-services.json
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
+
+# Version control
+vcs.xml
+
+# lint
+lint/intermediates/
+lint/generated/
+lint/outputs/
+lint/tmp/
+# lint/reports/
+app/google-services.json
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..5763267
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml
new file mode 100644
index 0000000..8ec256a
--- /dev/null
+++ b/.idea/render.experimental.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..65d12b9
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1,2 @@
+/build
+google-services.json
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..e2398e5
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,74 @@
+apply plugin: 'com.android.application'
+apply plugin: 'com.google.gms.google-services'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.1"
+ defaultConfig {
+ applicationId "info.anwesha.iitp"
+ minSdkVersion 21
+ targetSdkVersion 29
+ versionCode 5
+ versionName "1.4"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debugMini {
+ initWith debug
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ matchingFallbacks = ['debug']
+ }
+ }
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'com.google.android.material:material:1.0.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'androidx.palette:palette:1.0.0'
+
+ implementation "androidx.preference:preference:1.1.0"
+
+ implementation 'com.google.android.play:core:1.6.4'
+
+ implementation 'androidx.navigation:navigation-fragment:2.1.0'
+ implementation 'androidx.navigation:navigation-ui:2.1.0'
+
+ implementation 'androidx.room:room-runtime:2.2.1'
+ annotationProcessor 'androidx.room:room-compiler:2.2.1'
+ androidTestImplementation 'androidx.room:room-testing:2.2.1'
+
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
+ annotationProcessor 'androidx.lifecycle:lifecycle-common-java8:2.1.0'
+
+ implementation 'com.google.firebase:firebase-core:17.2.1'
+ implementation 'com.google.firebase:firebase-messaging:20.0.0'
+ implementation 'com.google.firebase:firebase-appindexing:19.0.0'
+
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
+
+ implementation 'com.squareup.retrofit2:retrofit:2.6.1'
+ implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
+
+ implementation 'com.github.chrisbanes:PhotoView:2.3.0'
+
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..a9dd785
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,24 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
+
+-keepattributes *Annotation*, Signature, Exception
+-keep class com.firebase.** { *; }
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..175c29f
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/AuthApi.java b/app/src/main/java/info/anwesha/iitp/Auth/AuthApi.java
new file mode 100644
index 0000000..a712d53
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/AuthApi.java
@@ -0,0 +1,24 @@
+package info.anwesha.iitp.Auth;
+
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.http.Body;
+import retrofit2.http.POST;
+
+public interface AuthApi {
+
+ @POST("backend/user/functions/mob_functions.php")
+ Call login(@Body RequestBody body);
+
+ @POST("backend/user/functions/mob_functions.php")
+ Call logout(@Body RequestBody body);
+
+ @POST("backend/user/functions/mob_functions.php")
+ Call register(@Body RequestBody body);
+
+ @POST("backend/user/functions/mob_functions.php")
+ Call resend_activation(@Body RequestBody body);
+
+ @POST("backend/user/functions/mob_functions.php")
+ Call getProfile(@Body RequestBody body);
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/LoginFragment.java b/app/src/main/java/info/anwesha/iitp/Auth/LoginFragment.java
new file mode 100644
index 0000000..ac50d1e
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/LoginFragment.java
@@ -0,0 +1,172 @@
+package info.anwesha.iitp.Auth;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.CheckNetwork;
+import info.anwesha.iitp.utils.Keyboard;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class LoginFragment extends Fragment {
+
+ private EditText celestaIdInput, passwordInput;
+ private Button loginButton;
+ private ProgressDialog progressDialog;
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_login, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ TextView registerTextView = view.findViewById(R.id.register_textview);
+ registerTextView.setOnClickListener(view1 -> loadFragment(new RegisterFragment()));
+
+ TextView resendActivationTextView = view.findViewById(R.id.resend_activation_email_textview);
+ resendActivationTextView.setOnClickListener(view12 -> loadFragment(new ResendActivationFragment()));
+
+ celestaIdInput = view.findViewById(R.id.login_celesta_Id_edittext);
+ passwordInput = view.findViewById(R.id.login_password_edittext);
+ loginButton = view.findViewById(R.id.login_button);
+
+ ImageView imageView = view.findViewById(R.id.login_image);
+ Glide.with(requireContext()).load(R.drawable.celesta_logo_long_2).into(imageView);
+
+ loginButton.setOnClickListener(view13 -> {
+ if (!CheckNetwork.isNetworkConnected(context))
+ Toast.makeText(getContext(), "Check your internet connection", Toast.LENGTH_LONG).show();
+ else login();
+ });
+
+ celestaIdInput.addTextChangedListener(loginTextWatcher);
+ passwordInput.addTextChangedListener(loginTextWatcher);
+ }
+
+ private void loadFragment(Fragment fragment) {
+ if (fragment != null && getActivity() != null) {
+ getActivity().getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_auth_container, fragment)
+ .commit();
+ }
+ }
+
+ private TextWatcher loginTextWatcher = new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ String celestaIdInput = LoginFragment.this.celestaIdInput.getText().toString().trim();
+ String passwordInput = LoginFragment.this.passwordInput.getText().toString().trim();
+
+ loginButton.setEnabled(!celestaIdInput.isEmpty() && !passwordInput.isEmpty());
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ }
+ };
+
+ private void login() {
+ Keyboard.closeKeyboard(getView(), context);
+
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setCancelable(false);
+ progressDialog.setMessage("Logging in...");
+ progressDialog.show();
+
+ info.anwesha.iitp.Auth.AuthApi authApi = RetrofitClientInstance.getRetrofitInstance().create(AuthApi.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("f", "login_user")
+ .addFormDataPart("celestaid", celestaIdInput.getText().toString().trim())
+ .addFormDataPart("password", passwordInput.getText().toString().trim())
+ .build();
+
+ Call call = authApi.login(requestBody);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+
+ if (response.isSuccessful() && response.body() != null) {
+
+ info.anwesha.iitp.Auth.LoginResponse loginResponse = response.body();
+
+ if (loginResponse.getStatus() == 202) {
+ Log.e("success", "access_token: " + loginResponse.getAccessToken());
+ storeData(loginResponse);
+ Toast.makeText(context, "Login successful", Toast.LENGTH_SHORT).show();
+
+ if (getActivity() != null)
+ getActivity().finish();
+
+ } else if (loginResponse.getStatus() == 403) {
+ List message = loginResponse.getMessage();
+ Toast.makeText(context, message.get(0), Toast.LENGTH_LONG).show();
+ }
+
+ } else Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ if (progressDialog != null) progressDialog.dismiss();
+ Log.e("Error", "onFailure: " + t.getMessage());
+ Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ private void storeData(LoginResponse response) {
+ PreferenceManager.getDefaultSharedPreferences(context).edit()
+ .putBoolean("login_status", true)
+ .putString("celesta_id", response.getCelestaId())
+ .putString("access_token", response.getAccessToken())
+ .putString("first_name", response.getFirstName())
+ .putString("qr_code", response.getQrCode())
+ .apply();
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/LoginRegisterActivity.java b/app/src/main/java/info/anwesha/iitp/Auth/LoginRegisterActivity.java
new file mode 100644
index 0000000..2911e4d
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/LoginRegisterActivity.java
@@ -0,0 +1,33 @@
+package info.anwesha.iitp.Auth;
+
+import android.content.SharedPreferences;
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
+
+import info.anwesha.iitp.R;
+
+public class LoginRegisterActivity extends AppCompatActivity {
+ SharedPreferences sharedPreferences;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ getWindow().setBackgroundDrawableResource(R.drawable.back);
+ setContentView(R.layout.activity_login_signup);
+
+ if (!sharedPreferences.getBoolean("login_status", false))
+ loadFragment(new LoginFragment());
+ else loadFragment(new ProfileFragment());
+ }
+
+ private void loadFragment(Fragment fragment) {
+ if (fragment != null) getSupportFragmentManager().beginTransaction()
+ .add(R.id.fragment_auth_container, fragment)
+ .commit();
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/LoginResponse.java b/app/src/main/java/info/anwesha/iitp/Auth/LoginResponse.java
new file mode 100644
index 0000000..72e0382
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/LoginResponse.java
@@ -0,0 +1,72 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+@Keep
+public class LoginResponse {
+
+ @SerializedName("status")
+ private Integer status;
+ @SerializedName("message")
+ private List message;
+ @SerializedName("celestaid")
+ private String celestaId ="";
+ @SerializedName("access_token")
+ private String accessToken ="";
+ @SerializedName("first_name")
+ private String firstName ="";
+ @SerializedName("qrcode")
+ private String qrCode ="";
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public List getMessage() {
+ return message;
+ }
+
+ public void setMessage(List message) {
+ this.message = message;
+ }
+
+ public String getCelestaId() {
+ return celestaId;
+ }
+
+ public void setCelestaId(String celestaId) {
+ this.celestaId = celestaId;
+ }
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getQrCode() {
+ return qrCode;
+ }
+
+ public void setQrCode(String qrCode) {
+ this.qrCode = qrCode;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/LogoutResponse.java b/app/src/main/java/info/anwesha/iitp/Auth/LogoutResponse.java
new file mode 100644
index 0000000..dc006f3
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/LogoutResponse.java
@@ -0,0 +1,32 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+@Keep
+public class LogoutResponse{
+
+ @SerializedName("status")
+ private Integer status;
+ @SerializedName("message")
+ private List message;
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public List getMessage() {
+ return message;
+ }
+
+ public void setMessage(List message) {
+ this.message = message;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/ProfileFragment.java b/app/src/main/java/info/anwesha/iitp/Auth/ProfileFragment.java
new file mode 100644
index 0000000..e08ddb2
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/ProfileFragment.java
@@ -0,0 +1,281 @@
+package info.anwesha.iitp.Auth;
+
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.text.Spannable;
+import android.text.SpannableStringBuilder;
+import android.text.style.ForegroundColorSpan;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+import com.google.gson.Gson;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.anwesha.iitp.Auth.AuthApi;
+import info.anwesha.iitp.Auth.LogoutResponse;
+import info.anwesha.iitp.Auth.ProfileResponse;
+import info.anwesha.iitp.Auth.RegisteredEventItem;
+import info.anwesha.iitp.Auth.RegisteredEventsAdapter;
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.CheckNetwork;
+import info.anwesha.iitp.utils.ImageViewerActivity;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class ProfileFragment extends Fragment {
+
+ private TextView celestaIdTextView, firstNameTextView;
+ private ImageView qrImage;
+ private SharedPreferences preferences;
+ private ProgressDialog progressDialog;
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_profile, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ Button logout_button = view.findViewById(R.id.profile_logout_button);
+ celestaIdTextView = view.findViewById(R.id.profile_celestaid);
+ firstNameTextView = view.findViewById(R.id.profile_first_name);
+ qrImage = view.findViewById(R.id.profile_qrcode);
+
+ logout_button.setOnClickListener(view1 -> {
+ if (!CheckNetwork.isNetworkConnected(context))
+ Toast.makeText(getContext(), "Check Internet connection", Toast.LENGTH_SHORT).show();
+ else logout();
+ });
+
+ showOfflineProfile();
+ profileApi();
+ }
+
+ private void logout() {
+ logoutApi();
+ clearSharedPreference();
+ }
+
+ private void clearSharedPreference() {
+ SharedPreferences.Editor sharedPreferenceEditor = preferences.edit();
+ sharedPreferenceEditor.putBoolean("login_status", false);
+ sharedPreferenceEditor.putString("celesta_id", "");
+ sharedPreferenceEditor.putString("access_token", "");
+ sharedPreferenceEditor.putString("first_name", "");
+ sharedPreferenceEditor.putString("qr_code", "");
+ sharedPreferenceEditor.apply();
+ }
+
+ private void logoutApi() {
+ String celestaId = preferences.getString("celesta_id", "");
+ String accessToken = preferences.getString("access_token", "");
+
+ progressDialog = new ProgressDialog(getContext());
+ progressDialog.setCancelable(false);
+ progressDialog.setMessage("Logging out...");
+ progressDialog.show();
+
+ AuthApi authApi = RetrofitClientInstance.getRetrofitInstance().create(AuthApi.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("f", "logout_user")
+ .addFormDataPart("celestaid", celestaId)
+ .addFormDataPart("access_token", accessToken)
+ .build();
+
+ Call call = authApi.logout(requestBody);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+
+ if (response.isSuccessful() && response.body() != null) {
+
+ LogoutResponse logoutResponse = response.body();
+
+ if (logoutResponse.getStatus() == 202) {
+ Toast.makeText(context, response.body().getMessage().get(0), Toast.LENGTH_SHORT).show();
+
+ if (getActivity() != null)
+ getActivity().finish();
+ } else {
+ Toast.makeText(getContext(), response.body().getMessage().get(0), Toast.LENGTH_SHORT).show();
+ }
+ } else {
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ if (progressDialog != null) progressDialog.dismiss();
+ Log.e("failed", "onFailure: " + t.getMessage());
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ private void showOfflineProfile() {
+ String qrCode = preferences.getString("qr_code", "");
+ Glide.with(context)
+ .load(qrCode)
+ .thumbnail(Glide.with(context).load(R.raw.load))
+ .into(qrImage);
+
+ qrImage.setOnClickListener(view12 -> {
+ Intent i = new Intent(context, ImageViewerActivity.class);
+ i.putExtra("image_url", qrCode);
+ startActivity(i);
+ });
+
+ String celestaId = preferences.getString("celesta_id", "");
+ celestaIdTextView.setText(celestaId);
+
+ String firstName = "Hello " + preferences.getString("first_name", "");
+ firstNameTextView.setText(firstName);
+ }
+
+ private void profileApi() {
+ String celestaId = preferences.getString("celesta_id", "");
+ String accessToken = preferences.getString("access_token", "");
+
+ AuthApi authApi = RetrofitClientInstance.getRetrofitInstance().create(AuthApi.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("f", "user_profile")
+ .addFormDataPart("celestaid", celestaId)
+ .addFormDataPart("access_token", accessToken)
+ .build();
+
+ Call call = authApi.getProfile(requestBody);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (response.isSuccessful() && response.body() != null) {
+
+ ProfileResponse profileResponse = response.body();
+
+ if (profileResponse.getStatus() == 202) {
+ populateProfile(profileResponse);
+ } else {
+ Toast.makeText(getContext(), response.body().getMessage().get(0), Toast.LENGTH_LONG).show();
+ }
+ } else {
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ Log.e("failed", "onFailure: " + t.getMessage());
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ private void populateProfile(ProfileResponse response) {
+
+ if (getView() != null && response != null) {
+
+ ((TextView)getView().findViewById(R.id.profile_loading_events)).setText("Registered Events : ");
+
+ SpannableStringBuilder spn = new SpannableStringBuilder(response.getProfile().getFirstName() + " " + response.getProfile().getLastName());
+ spn.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.medBlue)), 0, spn.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ firstNameTextView.setText("");
+ firstNameTextView.append("Hello ");
+ firstNameTextView.append(spn);
+ firstNameTextView.append("\nEmail : " + response.getProfile().getEmail());
+ firstNameTextView.append("\nPhone : " + response.getProfile().getPhone());
+ firstNameTextView.append("\nAmount Paid : ₹ " + response.getProfile().getAmountPaid());
+
+ RecyclerView recyclerView = getView().findViewById(R.id.recycler_profile_events);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+
+ RegisteredEventsAdapter adapter = new RegisteredEventsAdapter(getContext());
+ recyclerView.setAdapter(adapter);
+
+ List allRegisteredEvents = new ArrayList<>();
+
+ String registered = response.getProfile().getEventsRegistered();
+
+ if (registered != null && !registered.equals("null") && !registered.isEmpty()) {
+
+ List allEvents = response.getEvents();
+
+ String regMod = "{\"events\":" + registered + "}";
+
+ Gson gson = new Gson();
+ try {
+ JSONObject object = new JSONObject(regMod);
+
+ JSONArray a = object.getJSONArray("events");
+
+ for (int i = 0; i < a.length(); i++) {
+
+ RegisteredEventItem item = gson.fromJson(a.getJSONObject(i).toString(), RegisteredEventItem.class);
+
+ for (ProfileResponse.Event e : allEvents) {
+ if (e.getEvId().equals(item.getEventId())) {
+ item.setAmountToBePaid(Integer.parseInt(e.getEvAmount()));
+ break;
+ }
+ }
+
+ allRegisteredEvents.add(item);
+ }
+
+ } catch (JSONException e) {
+ Toast.makeText(context, "Failed to parse events data!!!", Toast.LENGTH_SHORT).show();
+ e.printStackTrace();
+ }
+ }
+ adapter.setEventList(allRegisteredEvents);
+
+ }
+
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/ProfileResponse.java b/app/src/main/java/info/anwesha/iitp/Auth/ProfileResponse.java
new file mode 100644
index 0000000..88c7b43
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/ProfileResponse.java
@@ -0,0 +1,197 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Keep
+public class ProfileResponse {
+
+ @SerializedName("status")
+ @Expose
+ private Integer status;
+ @SerializedName("profile")
+ @Expose
+ private Profile profile;
+ @SerializedName("events")
+ @Expose
+ private List events = null;
+ @SerializedName("message")
+ @Expose
+ private List message;
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Profile getProfile() {
+ return profile;
+ }
+
+ public void setProfile(Profile profile) {
+ this.profile = profile;
+ }
+
+ public List getMessage() {
+ if (message == null) {
+ message = new ArrayList<>();
+ message.add("");
+ }
+ return message;
+ }
+
+ public void setMessage(List message) {
+ this.message = message;
+ }
+
+ public List getEvents() {
+ return events;
+ }
+
+ public void setEvents(List events) {
+ this.events = events;
+ }
+
+ @Keep
+ public class Profile {
+
+ @SerializedName("celestaid")
+ @Expose
+ private String celestaId;
+ @SerializedName("first_name")
+ @Expose
+ private String firstName;
+ @SerializedName("last_name")
+ @Expose
+ private String lastName;
+ @SerializedName("email")
+ @Expose
+ private String email;
+ @SerializedName("phone")
+ @Expose
+ private String phone;
+ @SerializedName("qrcode")
+ @Expose
+ private String qrCode;
+ @SerializedName("events_registered")
+ @Expose
+ private String eventsRegistered;
+ @SerializedName("access_token")
+ @Expose
+ private String accessToken;
+ @SerializedName("amount_paid")
+ @Expose
+ private String amountPaid;
+
+
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getEventsRegistered() {
+ return eventsRegistered;
+ }
+
+ public void setEventsRegistered(String eventsRegistered) {
+ this.eventsRegistered = eventsRegistered;
+ }
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public String getAmountPaid() {
+ return amountPaid;
+ }
+
+ public void setAmountPaid(String amountPaid) {
+ this.amountPaid = amountPaid;
+ }
+
+ public String getCelestaId() {
+ return celestaId;
+ }
+
+ public void setCelestaId(String celestaId) {
+ this.celestaId = celestaId;
+ }
+
+ public String getQrCode() {
+ return qrCode;
+ }
+
+ public void setQrCode(String qrCode) {
+ this.qrCode = qrCode;
+ }
+ }
+
+ @Keep
+ public class Event {
+
+ @SerializedName("ev_id")
+ @Expose
+ private String evId;
+ @SerializedName("ev_amount")
+ @Expose
+ private String evAmount;
+
+ public String getEvId() {
+ return evId;
+ }
+
+ public void setEvId(String evId) {
+ this.evId = evId;
+ }
+
+ public String getEvAmount() {
+ return evAmount;
+ }
+
+ public void setEvAmount(String evAmount) {
+ this.evAmount = evAmount;
+ }
+
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/RegisterFragment.java b/app/src/main/java/info/anwesha/iitp/Auth/RegisterFragment.java
new file mode 100644
index 0000000..c51d72b
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/RegisterFragment.java
@@ -0,0 +1,189 @@
+package info.anwesha.iitp.Auth;
+
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.CheckNetwork;
+import info.anwesha.iitp.utils.Keyboard;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class RegisterFragment extends Fragment {
+
+ private EditText firstNameInput, lastNameInput, phoneInput, emailInput, collegeInput, passwordInput, confirmPasswordInput, referralInput, genderInput;
+ private ProgressDialog progressDialog;
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_register, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ firstNameInput = view.findViewById(R.id.register_first_name_edittext);
+ lastNameInput = view.findViewById(R.id.register_last_name_edittext);
+ phoneInput = view.findViewById(R.id.register_phone_edittext);
+ emailInput = view.findViewById(R.id.register_email_edittext);
+ collegeInput = view.findViewById(R.id.register_school_college_edittext);
+ passwordInput = view.findViewById(R.id.register_password_edittext);
+ confirmPasswordInput = view.findViewById(R.id.register_confirm_password_edittext);
+ referralInput = view.findViewById(R.id.register_referral_edittext);
+ genderInput = view.findViewById(R.id.register_gender_edittext);
+
+ TextView loginTextView = view.findViewById(R.id.login_textview);
+ loginTextView.setOnClickListener(view12 -> loadFragment(new info.anwesha.iitp.Auth.LoginFragment()));
+
+ ImageView imageView = view.findViewById(R.id.register_image);
+ Glide.with(getContext()).load(R.drawable.celesta_logo_long_2).into(imageView);
+
+ Button registerButton = view.findViewById(R.id.register_button);
+ registerButton.setOnClickListener(view1 -> {
+ if (!CheckNetwork.isNetworkConnected(context))
+ Toast.makeText(getContext(), "Check your internet connection!!!", Toast.LENGTH_LONG).show();
+ else register();
+ });
+ }
+
+ private void loadFragment(Fragment fragment) {
+ if (fragment != null && getActivity() != null) {
+ getActivity().getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_auth_container, fragment)
+ .commit();
+ }
+ }
+
+ private void register() {
+ String firstName, lastName, phone, email, college, password, confirmPassword, referral, gender;
+ firstName = firstNameInput.getText().toString().trim();
+ lastName = lastNameInput.getText().toString().trim();
+ phone = phoneInput.getText().toString().trim();
+ email = emailInput.getText().toString().trim();
+ college = collegeInput.getText().toString().trim();
+ password = passwordInput.getText().toString().trim();
+ confirmPassword = confirmPasswordInput.getText().toString().trim();
+ gender = genderInput.getText().toString().toLowerCase().trim();
+
+ if (password.isEmpty() || confirmPassword.isEmpty() || !password.equals(confirmPassword)) {
+ confirmPasswordInput.setError("Passwords don't match!!!");
+ return;
+ }
+
+ if (!("m".equals(gender) || "f".equals(gender))) {
+ genderInput.setError("Enter a valid gender!!!");
+ return;
+ }
+
+ if (phone.isEmpty()) {
+ phoneInput.setError("Enter a valid phone number!!!");
+ return;
+ }
+
+ if (firstName.length() < 3) {
+ firstNameInput.setError("Enter a valid name!!!");
+ return;
+ }
+
+ if (lastName.isEmpty()) {
+ lastNameInput.setError("Enter a valid name!!!");
+ return;
+ }
+
+ referral = referralInput.getText().toString().trim();
+ if (referral.isEmpty()) referral = "CLST1504";
+
+ Keyboard.closeKeyboard(getView(), context);
+
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setCancelable(false);
+ progressDialog.setMessage("Registering...");
+ progressDialog.show();
+
+ info.anwesha.iitp.Auth.AuthApi authApi = RetrofitClientInstance.getRetrofitInstance().create(AuthApi.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("f", "register_user")
+ .addFormDataPart("first_name", firstName)
+ .addFormDataPart("last_name", lastName)
+ .addFormDataPart("phone", phone)
+ .addFormDataPart("college", college)
+ .addFormDataPart("email", email)
+ .addFormDataPart("password", password)
+ .addFormDataPart("confirm_password", confirmPassword)
+ .addFormDataPart("gender", gender)
+ .addFormDataPart("referral_id", referral)
+ .build();
+
+ Call call = authApi.register(requestBody);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+ if (response.isSuccessful() && response.body() != null) {
+
+ info.anwesha.iitp.Auth.RegisterResponse registerResponse = response.body();
+
+ if (registerResponse.getStatus() == 200) {
+ Toast.makeText(getContext(), "Registration successful.Check your email for activation link", Toast.LENGTH_LONG).show();
+ new Handler().postDelayed(() -> loadFragment(new LoginFragment()), 1000);
+ } else if (registerResponse.getStatus() == 400) {
+ List messages = registerResponse.getMessage();
+
+ StringBuilder err = new StringBuilder();
+ for (String temp : messages) err = err.append(temp).append("\n");
+ Log.e("messages", "onResponse: err= " + err.toString());
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ builder.setMessage(err.toString());
+ builder.setTitle("Alert!!!");
+ builder.show();
+ }
+ } else
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ progressDialog.dismiss();
+ Log.e("Error", "onFailure: " + t.getMessage());
+ Toast.makeText(getContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/RegisterResponse.java b/app/src/main/java/info/anwesha/iitp/Auth/RegisterResponse.java
new file mode 100644
index 0000000..ffadef3
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/RegisterResponse.java
@@ -0,0 +1,32 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+@Keep
+public class RegisterResponse {
+
+ @SerializedName("status")
+ private Integer status;
+ @SerializedName("message")
+ private List message;
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public List getMessage() {
+ return message;
+ }
+
+ public void setMessage(List message) {
+ this.message = message;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventItem.java b/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventItem.java
new file mode 100644
index 0000000..20e69f4
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventItem.java
@@ -0,0 +1,60 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.SerializedName;
+
+@Keep
+public class RegisteredEventItem {
+
+ @SerializedName("ev_id")
+ private String eventId;
+ @SerializedName("ev_name")
+ private String eventName;
+ @SerializedName("amount")
+ private int amountPaid;
+ @SerializedName("team_name")
+ private String teamName;
+
+ private int amountToBePaid;
+
+ public int getAmountToBePaid() {
+ return amountToBePaid;
+ }
+
+ public void setAmountToBePaid(int amountToBePaid) {
+ this.amountToBePaid = amountToBePaid;
+ }
+
+ public String getEventId() {
+ return eventId;
+ }
+
+ public void setEventId(String eventId) {
+ this.eventId = eventId;
+ }
+
+ public String getEventName() {
+ return eventName;
+ }
+
+ public void setEventName(String eventName) {
+ this.eventName = eventName;
+ }
+
+ public int getAmountPaid() {
+ return amountPaid;
+ }
+
+ public void setAmountPaid(int amountPaid) {
+ this.amountPaid = amountPaid;
+ }
+
+ public String getTeamName() {
+ return teamName;
+ }
+
+ public void setTeamName(String teamName) {
+ this.teamName = teamName;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventsAdapter.java b/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventsAdapter.java
new file mode 100644
index 0000000..468b8c1
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/RegisteredEventsAdapter.java
@@ -0,0 +1,95 @@
+package info.anwesha.iitp.Auth;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+import java.util.Locale;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.utils.IntentUtils;
+
+public class RegisteredEventsAdapter extends RecyclerView.Adapter{
+
+ private Context context;
+ private List eventList;
+
+ public RegisteredEventsAdapter(Context context) {
+ this.context = context;
+ }
+
+ @NonNull
+ @Override
+ public RegisteredEventsAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_registered_events, parent, false);
+ return new RegisteredEventsAdapter.ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final RegisteredEventsAdapter.ViewHolder holder, int position) {
+
+ if (eventList != null) {
+ final info.anwesha.iitp.Auth.RegisteredEventItem current = eventList.get(position);
+
+ holder.name.setText(current.getEventName());
+
+ if (current.getAmountToBePaid() > 0 && current.getAmountPaid() == 0) {
+ holder.button.setText(String.format(Locale.getDefault(), "Pay\n(₹%d)", current.getAmountToBePaid()));
+ holder.button.setVisibility(View.VISIBLE);
+ }
+
+ if (current.getTeamName() != null && !current.getTeamName().isEmpty()) {
+ holder.team.setText(String.format("Team: %s", current.getTeamName()));
+ holder.team.setVisibility(View.VISIBLE);
+ }
+
+ if (current.getAmountToBePaid() > 0) {
+ holder.paid.setText(String.format("Paid: ₹ %s", String.valueOf(current.getAmountPaid())));
+ } else holder.paid.setText("Free Event");
+
+ holder.button.setOnClickListener(view -> {
+ String url = "https://celesta.org.in/events/eventsdetails.php?id=" + current.getEventId();
+ IntentUtils.openWebBrowser(context, url);
+ });
+
+ } else {
+ holder.name.setText("Loading ...");
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (eventList != null)
+ return eventList.size();
+ else return 0;
+ }
+
+ class ViewHolder extends RecyclerView.ViewHolder {
+
+ TextView name;
+ TextView paid;
+ TextView button;
+ TextView team;
+ View rootLayout;
+
+ ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ name = itemView.findViewById(R.id.tv_event_name);
+ rootLayout = itemView.findViewById(R.id.root_registered_events);
+ paid = itemView.findViewById(R.id.tv_paid_amount);
+ team = itemView.findViewById(R.id.team_name);
+ button = itemView.findViewById(R.id.button_pay_now);
+ }
+ }
+
+ public void setEventList(List eventList) {
+ this.eventList = eventList;
+ notifyDataSetChanged();
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationFragment.java b/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationFragment.java
new file mode 100644
index 0000000..6129a5e
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationFragment.java
@@ -0,0 +1,128 @@
+package info.anwesha.iitp.Auth;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+import com.bumptech.glide.Glide;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.CheckNetwork;
+import info.anwesha.iitp.utils.Keyboard;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class ResendActivationFragment extends Fragment {
+ private EditText emailInput;
+ private ProgressDialog progressDialog;
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_resend_activation, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ emailInput = view.findViewById(R.id.resend_activation_email_edittext);
+
+ TextView registerTextView = view.findViewById(R.id.resend_activation_register_textview);
+ registerTextView.setOnClickListener(view1 -> loadFragment(new RegisterFragment()));
+
+ ImageView imageView = view.findViewById(R.id.resend_image);
+ Glide.with( requireContext() ).load( R.drawable.celesta_logo_long_2 ).into(imageView);
+
+ Button resendActivationButton = view.findViewById(R.id.resend_activation_button);
+ resendActivationButton.setOnClickListener(view12 -> {
+ if (!CheckNetwork.isNetworkConnected(context))
+ Toast.makeText(context, "Check your internet connection...", Toast.LENGTH_LONG).show();
+ else resend_activation();
+ });
+ }
+
+ private void loadFragment(Fragment fragment) {
+ if (fragment != null && getActivity() != null) {
+ getActivity().getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_auth_container, fragment)
+ .commit();
+ }
+ }
+
+ private void resend_activation() {
+ Keyboard.closeKeyboard(getView(), context);
+ String email = emailInput.getText().toString().trim();
+
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setMessage("Resending link in email...");
+ progressDialog.show();
+
+ info.anwesha.iitp.Auth.AuthApi authApi = RetrofitClientInstance.getRetrofitInstance().create(AuthApi.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("f", "resend_activation_link")
+ .addFormDataPart("email", email)
+ .build();
+
+ Call call = authApi.resend_activation(requestBody);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+ if (response.isSuccessful() && response.body() != null) {
+
+ info.anwesha.iitp.Auth.ResendActivationResponse activationResponse = response.body();
+
+ if (activationResponse.getStatus() == 404) {
+ Toast.makeText(context, "Email not found! Please register again.", Toast.LENGTH_LONG).show();
+ } else if (activationResponse.getStatus() == 200) {
+ Toast.makeText(context, "Check your email for activation link...", Toast.LENGTH_LONG).show();
+ loadFragment(new info.anwesha.iitp.Auth.LoginFragment());
+ } else if (activationResponse.getStatus() == 208) {
+ Toast.makeText(context, "Account already activated! Login again.", Toast.LENGTH_LONG).show();
+ loadFragment(new LoginFragment());
+ } else {
+ Toast.makeText(context, "Something went wrong!!! " + activationResponse.getMessage().get(0), Toast.LENGTH_LONG).show();
+ }
+ for (String temp : activationResponse.getMessage())
+ Log.e("messages", "onResponse: " + temp);
+ } else
+ Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ if (progressDialog != null) progressDialog.dismiss();
+ Log.e("failed", "onFailure: " + t.getMessage());
+ Toast.makeText(context, "Could not resend email verification!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationResponse.java b/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationResponse.java
new file mode 100644
index 0000000..34ff1e1
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/Auth/ResendActivationResponse.java
@@ -0,0 +1,31 @@
+package info.anwesha.iitp.Auth;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+@Keep
+public class ResendActivationResponse {
+ @SerializedName("status")
+ private Integer status;
+ @SerializedName("message")
+ private List message;
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public List getMessage() {
+ return message;
+ }
+
+ public void setMessage(List message) {
+ this.message = message;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/about/AboutFragment.java b/app/src/main/java/info/anwesha/iitp/about/AboutFragment.java
new file mode 100644
index 0000000..75aeffc
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/about/AboutFragment.java
@@ -0,0 +1,148 @@
+package info.anwesha.iitp.about;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.cardview.widget.CardView;
+import androidx.fragment.app.Fragment;
+
+import com.bumptech.glide.Glide;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.utils.IntentUtils;
+
+public class AboutFragment extends Fragment implements View.OnClickListener {
+
+
+ public AboutFragment() {
+ }
+
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_about, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ ImageView image1 = view.findViewById(R.id.image1);
+ ImageView image2 = view.findViewById(R.id.image2);
+ ImageView image3 = view.findViewById(R.id.image3);
+ ImageView image4 = view.findViewById(R.id.image4);
+
+ CardView call1 = view.findViewById(R.id.card_call_1);
+ CardView call2 = view.findViewById(R.id.card_call_2);
+ CardView call3 = view.findViewById(R.id.card_call_3);
+ CardView call4 = view.findViewById(R.id.card_call_4);
+
+ call1.setOnClickListener(this);
+ call2.setOnClickListener(this);
+ call3.setOnClickListener(this);
+ call4.setOnClickListener(this);
+
+ CardView facebook1 = view.findViewById(R.id.card_facebook_1);
+ CardView facebook2 = view.findViewById(R.id.card_facebook_2);
+ CardView facebook3 = view.findViewById(R.id.card_facebook_3);
+ CardView facebook4 = view.findViewById(R.id.card_facebook_4);
+
+ facebook1.setOnClickListener(this);
+ facebook2.setOnClickListener(this);
+ facebook3.setOnClickListener(this);
+ facebook4.setOnClickListener(this);
+
+
+ CardView github1 = view.findViewById(R.id.card_github_1);
+ CardView github2 = view.findViewById(R.id.card_github_2);
+ CardView github3 = view.findViewById(R.id.card_github_3);
+ CardView github4 = view.findViewById(R.id.card_github_4);
+
+ github1.setOnClickListener(this);
+ github2.setOnClickListener(this);
+ github3.setOnClickListener(this);
+ github4.setOnClickListener(this);
+
+ Glide.with(context).load("https://scontent.fdel29-1.fna.fbcdn.net/v/t1.0-9/61836104_1185350021642288_3218647400700706816_n.jpg?_nc_cat=102&_nc_oc=AQks_Avrh-QmlQFcHGi2ug38TMWNY4xy6qpFT8fxfz451NDS3ahAIUOVwKIbn-O6KmE&_nc_ht=scontent.fdel29-1.fna&oh=ba5d514048981767bdc4b4c909b6708a&oe=5E35BDD7")
+ .placeholder(R.mipmap.celesta_icon_round).into(image1);
+
+ Glide.with(context).load("https://scontent.fdel29-1.fna.fbcdn.net/v/t1.0-9/69644261_2115104492128356_6176772960083247104_n.jpg?_nc_cat=107&_nc_oc=AQk4WEUseafFdQvhhWhu0YFH6_9o8nBkkjTU7UJPzeK0NPWeppaKVIVUMtJUAGIZ6Yk&_nc_ht=scontent.fdel29-1.fna&oh=818707c46121857a62041b44ed4bd17c&oe=5DF2FCE3")
+ .placeholder(R.mipmap.celesta_icon_round).into(image2);
+
+ Glide.with(context).load("https://scontent.fdel29-1.fna.fbcdn.net/v/t1.0-9/18813995_1182737558521894_2753272857627730485_n.jpg?_nc_cat=101&_nc_oc=AQlG0F8XVl3PnNTA1LnzMcfZ3p4cElt7WOpCtOADvw6N7eQcw-97L2RhxGWq-T2VDGk&_nc_ht=scontent.fdel29-1.fna&oh=70217968ca8de55d0a842ceac8ab8f41&oe=5E3796AA")
+ .placeholder(R.mipmap.celesta_icon_round).into(image3);
+
+ Glide.with(context).load("https://scontent.fdel29-1.fna.fbcdn.net/v/t1.0-9/33490969_969879943175001_7316512759087104000_n.jpg?_nc_cat=105&_nc_oc=AQn_AxS6IX1lXlZZyVmn8sBqsAwQuU69Qg3VmDV65xgAmC_J9_zHJ5AkbPWEccCVU3A&_nc_ht=scontent.fdel29-1.fna&oh=871245e026dcfd1041ed75995ebe9deb&oe=5DF6A107")
+ .placeholder(R.mipmap.celesta_icon_round).into(image4);
+
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ @Override
+ public void onClick(View view) {
+ int id = view.getId();
+
+ Intent intent = new Intent();
+ switch (id) {
+ case R.id.card_call_1:
+ intent.setAction(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse("tel:+918299735195"));
+ break;
+ case R.id.card_call_2:
+ intent.setAction(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse("tel:+918967570983"));
+ break;
+ case R.id.card_call_3:
+ intent.setAction(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse("tel:+918013054710"));
+ break;
+ case R.id.card_call_4:
+ intent.setAction(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse("tel:+917424904721"));
+ break;
+ case R.id.card_facebook_1:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.facebook.com/ashwani.yadav9499");
+ return;
+ case R.id.card_facebook_2:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.facebook.com/atm1504");
+ return;
+ case R.id.card_facebook_3:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.facebook.com/somenath.sarkar.39");
+ return;
+ case R.id.card_facebook_4:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.facebook.com/amangrobo");
+ return;
+ case R.id.card_github_1:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://github.com/ashwaniYDV");
+ return;
+ case R.id.card_github_2:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://github.com/atm1504");
+ return;
+ case R.id.card_github_3:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://github.com/somenath1435");
+ return;
+ case R.id.card_github_4:
+ IntentUtils.openWebBrowser(context, "https://github.com/amangrobo/");
+ return;
+ }
+
+ startActivity(intent);
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/contact/ContactFragment.java b/app/src/main/java/info/anwesha/iitp/contact/ContactFragment.java
new file mode 100644
index 0000000..1cd647d
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/contact/ContactFragment.java
@@ -0,0 +1,81 @@
+package info.anwesha.iitp.contact;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.cardview.widget.CardView;
+import androidx.fragment.app.Fragment;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.utils.IntentUtils;
+
+public class ContactFragment extends Fragment implements View.OnClickListener {
+
+ private Context context;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getContext() != null)
+ this.context = getContext();
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_contact_us, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ CardView bus = view.findViewById(R.id.bus_schedule);
+ CardView fb = view.findViewById(R.id.connect_facebook);
+ CardView inst = view.findViewById(R.id.connect_instagram);
+ CardView twitter = view.findViewById(R.id.connect_twitter);
+ CardView youtube = view.findViewById(R.id.connect_youtube);
+ CardView link = view.findViewById(R.id.connect_linkedin);
+
+ fb.setOnClickListener(this);
+ inst.setOnClickListener(this);
+ twitter.setOnClickListener(this);
+ youtube.setOnClickListener(this);
+ link.setOnClickListener(this);
+ bus.setOnClickListener(this);
+
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ int id = view.getId();
+
+ switch (id) {
+ case R.id.bus_schedule:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.iitp.ac.in/index.php?option=com_content&view=article&id=60&Itemid=66");
+ break;
+ case R.id.connect_facebook:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.facebook.com/CelestaIITP/");
+ break;
+ case R.id.connect_instagram:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.instagram.com/celestaiitp_official/");
+ break;
+ case R.id.connect_twitter:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://twitter.com/celesta_iitp");
+ break;
+ case R.id.connect_youtube:
+ info.anwesha.iitp.utils.IntentUtils.openWebBrowser(context, "https://www.youtube.com/channel/UCd8RpmJktBOwqT4OehcCjjg");
+ break;
+ case R.id.connect_linkedin:
+ IntentUtils.openWebBrowser(context, "https://www.linkedin.com/in/celesta-iit-patna-3722b6166/");
+ break;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/database/AppDatabase.java b/app/src/main/java/info/anwesha/iitp/database/AppDatabase.java
new file mode 100644
index 0000000..2baa373
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/database/AppDatabase.java
@@ -0,0 +1,39 @@
+package info.anwesha.iitp.database;
+
+import android.content.Context;
+
+import androidx.room.Database;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+import androidx.room.TypeConverters;
+
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsDao;
+import info.anwesha.iitp.gallery.GalleryDao;
+import info.anwesha.iitp.gallery.Image;
+import info.anwesha.iitp.utils.Converters;
+
+@Database(entities = {EventItem.class, Image.class}, version = 3, exportSchema = false)
+@TypeConverters(Converters.class)
+public abstract class AppDatabase extends RoomDatabase {
+
+ private static volatile info.anwesha.iitp.database.AppDatabase INSTANCE;
+
+ public abstract EventsDao eventsDao();
+ public abstract GalleryDao galleryDao();
+
+ public static info.anwesha.iitp.database.AppDatabase getDatabase(Context context) {
+ if (INSTANCE == null) {
+ synchronized (info.anwesha.iitp.database.AppDatabase.class) {
+ if (INSTANCE == null) {
+ INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
+ info.anwesha.iitp.database.AppDatabase.class, "database")
+ .allowMainThreadQueries()
+ .fallbackToDestructiveMigration()
+ .build();
+ }
+ }
+ }
+ return INSTANCE;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventDetailsFragment.java b/app/src/main/java/info/anwesha/iitp/events/EventDetailsFragment.java
new file mode 100644
index 0000000..f401ac3
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventDetailsFragment.java
@@ -0,0 +1,373 @@
+package info.anwesha.iitp.events;
+
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.res.ColorStateList;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.cardview.widget.CardView;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.preference.PreferenceManager;
+
+import com.bumptech.glide.Glide;
+import com.google.android.material.bottomsheet.BottomSheetDialog;
+import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
+
+import java.util.List;
+
+import info.anwesha.iitp.Auth.LoginRegisterActivity;
+import info.anwesha.iitp.Auth.LogoutResponse;
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsViewModel;
+import info.anwesha.iitp.network.EventsRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.ImageViewerActivity;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class EventDetailsFragment extends BottomSheetDialogFragment {
+
+ public EventDetailsFragment() {
+ }
+
+ private EventItem current;
+ private Context context;
+ private int[] color;
+ private SharedPreferences preferences;
+ private ProgressDialog progressDialog;
+
+ @Override
+ public int getTheme() {
+ return R.style.BaseBottomSheetDialog;
+ }
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ return new BottomSheetDialog(this.requireContext(), this.getTheme());
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ EventsViewModel viewModel = ViewModelProviders.of(this).get(EventsViewModel.class);
+
+ if (getContext() != null)
+ this.context = getContext();
+ else this.dismiss();
+
+ if (getArguments() != null) {
+ String id = getArguments().getString("data");
+ color = getArguments().getIntArray("color");
+ current = viewModel.getEventById(id);
+ if (current == null) this.dismiss();
+ } else this.dismiss();
+
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setCancelable(false);
+ progressDialog.setIndeterminate(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_event_details, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ ImageView poster = view.findViewById(R.id.poster);
+ Glide.with(context)
+ .asBitmap()
+ .load(current.getEvPosterUrl())
+ .centerCrop()
+ .placeholder(R.drawable.events_icon_2)
+ .into(poster);
+
+ poster.setOnClickListener(view14 -> {
+ Intent i = new Intent(context, ImageViewerActivity.class);
+ i.putExtra("image_url", current.getEvPosterUrl());
+ startActivity(i);
+ });
+
+ CardView cardPrimary = view.findViewById(R.id.card_event_details_primary);
+ CardView cardSecondary = view.findViewById(R.id.card_event_details_sec);
+ CardView cardTer = view.findViewById(R.id.card_event_details_ter);
+ CardView cardQua = view.findViewById(R.id.card_event_details_qua);
+ CardView cardPen = view.findViewById(R.id.card_event_details_pen);
+
+ Button register = view.findViewById(R.id.button_register);
+
+ if (color[0] != 0) {
+ cardPrimary.setCardBackgroundColor(color[0]);
+ cardSecondary.setCardBackgroundColor(color[0]);
+ cardTer.setCardBackgroundColor(color[0]);
+ cardQua.setCardBackgroundColor(color[0]);
+ cardPen.setCardBackgroundColor(color[0]);
+ register.setBackgroundTintList(ColorStateList.valueOf(color[0]));
+ }
+
+ TextView name = view.findViewById(R.id.name);
+ TextView date = view.findViewById(R.id.date);
+ TextView venue = view.findViewById(R.id.venue);
+ ImageButton map = view.findViewById(R.id.button_map);
+ TextView time = view.findViewById(R.id.time);
+ TextView description = view.findViewById(R.id.description);
+ TextView organisers = view.findViewById(R.id.organisers);
+ ImageView organiserPhone = view.findViewById(R.id.organiser_phone);
+ TextView rulebook = view.findViewById(R.id.rulebook);
+ ImageView rulebookImg = view.findViewById(R.id.rulebook_img);
+
+ if (color[2] != 0) {
+ name.setTextColor(color[2]);
+ date.setTextColor(color[2]);
+ venue.setTextColor(color[2]);
+ map.setImageTintList(ColorStateList.valueOf(color[2]));
+ time.setTextColor(color[2]);
+ description.setTextColor(color[2]);
+ organisers.setTextColor(color[2]);
+ organiserPhone.setImageTintList(ColorStateList.valueOf(color[2]));
+ rulebook.setTextColor(color[2]);
+ rulebookImg.setImageTintList(ColorStateList.valueOf(color[2]));
+ register.setTextColor(color[2]);
+ }
+
+ name.setText(current.getEvName());
+
+ if (current.getEvDescription() != null && !current.getEvDescription().isEmpty())
+ description.setText(current.getEvDescription());
+ else cardSecondary.setVisibility(View.GONE);
+
+ if (current.getEvDate() != null && !current.getEvDate().isEmpty())
+ date.setText(String.format("Date : %s", current.getEvDate()));
+
+ if (current.getEvVenue() != null && !current.getEvVenue().isEmpty())
+ venue.setText(String.format("Location : %s", current.getEvVenue()));
+
+ if (current.getMapUrl() != null && !current.getMapUrl().isEmpty()) {
+ map.setOnClickListener(view13 -> {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(current.getMapUrl()));
+ startActivity(intent);
+ });
+ }
+
+ if (current.getEvStartTime() != null && !current.getEvStartTime().isEmpty())
+ time.setText(String.format("Timing : %s - %s", current.getEvStartTime(), current.getEvEndTime()));
+
+ if (current.getEvOrganiser() != null && !current.getEvOrganiser().isEmpty())
+ organisers.setText(String.format("Organisers : %s", current.getEvOrganiser()));
+
+ if (current.getEvOrgPhone() != null && !current.getEvOrgPhone().isEmpty()) {
+ cardQua.setOnClickListener(view1 -> {
+ Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + current.getEvOrgPhone().split(",")[0]));
+ startActivity(intent);
+ });
+ } else {
+ organiserPhone.setVisibility(View.GONE);
+ }
+
+ if (current.getEvRuleBookUrl() != null && !current.getEvRuleBookUrl().isEmpty()) {
+ cardPen.setOnClickListener(view12 -> {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(current.getEvRuleBookUrl()));
+ startActivity(intent);
+ });
+ } else {
+ cardPen.setVisibility(View.GONE);
+ }
+
+ if (current.getEvAmount() != null && !current.getEvAmount().isEmpty()) {
+ register.setText(String.format("Register (₹ %s)", current.getEvAmount()));
+ }
+
+ register.setOnClickListener(view15 -> {
+ if (preferences.getBoolean("login_status", false)) {
+ if ("0".equals(current.getIsTeamEvent())) {
+
+ new AlertDialog.Builder(requireContext())
+ .setTitle("Register")
+ .setMessage("Register for solo event: " + current.getEvName() + " for ₹ " + current.getEvAmount())
+ .setNegativeButton("Cancel", (dialog, id) -> {
+ if (dialog != null) dialog.dismiss();
+ })
+ .setPositiveButton("Yes", (dialogInterface, i) -> registerSoloEvent())
+ .show();
+
+ } else {
+ showAlertDialog();
+ }
+ } else {
+ Toast.makeText(context, "You need to login first...", Toast.LENGTH_LONG).show();
+ Intent i = new Intent(context, LoginRegisterActivity.class);
+ startActivity(i);
+ }
+ });
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void registerSoloEvent() {
+
+ progressDialog.setMessage("Registering...");
+ if (progressDialog != null) progressDialog.show();
+
+ EventsRoutes api = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("celestaid", preferences.getString("celesta_id", ""))
+ .addFormDataPart("eventid", current.getEvId())
+ .addFormDataPart("access_token", preferences.getString("access_token", ""))
+ .build();
+
+ Call call = api.registerSoloEvent(requestBody);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+
+ if (response.isSuccessful() && response.body() != null) {
+
+ LogoutResponse registerResponse = response.body();
+
+ List message = registerResponse.getMessage();
+ if (message != null && message.size() > 0)
+ Toast.makeText(context, message.get(0), Toast.LENGTH_LONG).show();
+
+ } else Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ if (progressDialog != null) progressDialog.dismiss();
+ Log.e("Error", "onFailure: " + t.getMessage());
+ Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+
+ }
+
+ private void showAlertDialog() {
+ final View dialogView = getLayoutInflater().inflate(R.layout.dialog_register_team_event, null);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
+ builder.setView(dialogView);
+ builder.setCancelable(false);
+ builder.setNegativeButton("Cancel", (dialog, id) -> {
+ if (dialog != null) {
+ dialog.dismiss();
+ }
+ });
+ AlertDialog alertDialog = builder.create();
+
+ int memberCount = Integer.parseInt(current.getTeamMembers());
+
+ TextView teamCaptain = dialogView.findViewById(R.id.team_captain_celesta_id);
+ teamCaptain.setText(preferences.getString("celesta_id", ""));
+
+ EditText celestaId2 = dialogView.findViewById(R.id.input_celesta_id_2);
+ EditText celestaId3 = dialogView.findViewById(R.id.input_celesta_id_3);
+ EditText celestaId4 = dialogView.findViewById(R.id.input_celesta_id_4);
+ EditText celestaId5 = dialogView.findViewById(R.id.input_celesta_id_5);
+ EditText celestaId6 = dialogView.findViewById(R.id.input_celesta_id_6);
+
+ if (memberCount > 1)
+ celestaId2.setVisibility(View.VISIBLE);
+ if (memberCount > 2)
+ celestaId3.setVisibility(View.VISIBLE);
+ if (memberCount > 3)
+ celestaId4.setVisibility(View.VISIBLE);
+ if (memberCount > 4)
+ celestaId5.setVisibility(View.VISIBLE);
+ if (memberCount > 5)
+ celestaId6.setVisibility(View.VISIBLE);
+
+ Button registerButton = dialogView.findViewById(R.id.register_team_event);
+ registerButton.setOnClickListener(view -> {
+ EditText teamName = dialogView.findViewById(R.id.input_team_name);
+
+ if (teamName.getText().toString().isEmpty()) {
+ teamName.setError("Enter a valid team name!");
+ return;
+ }
+
+ registerTeamEvent(teamName.getText().toString(), celestaId2.getText().toString(), celestaId3.getText().toString(),
+ celestaId4.getText().toString(), celestaId5.getText().toString(), celestaId6.getText().toString(), alertDialog);
+ });
+
+ alertDialog.show();
+ }
+
+ private void registerTeamEvent(String teamName, String c1, String c2, String c3, String c4, String c5, AlertDialog alertDialog) {
+
+ progressDialog.setMessage("Registering...");
+ if (progressDialog != null) progressDialog.show();
+
+ EventsRoutes api = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("celestaid", preferences.getString("celesta_id", ""))
+ .addFormDataPart("eventid", current.getEvId())
+ .addFormDataPart("access_token", preferences.getString("access_token", ""))
+ .addFormDataPart("team_name", teamName)
+ .addFormDataPart("member1", c1)
+ .addFormDataPart("member2", c2)
+ .addFormDataPart("member3", c3)
+ .addFormDataPart("member4", c4)
+ .addFormDataPart("member5", c5)
+ .build();
+
+ Call call = api.registerTeamEvent(requestBody);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (progressDialog != null) progressDialog.dismiss();
+
+ if (response.isSuccessful() && response.body() != null) {
+
+ LogoutResponse registerResponse = response.body();
+
+ if (registerResponse.getStatus() == 202)
+ if (alertDialog != null) alertDialog.dismiss();
+
+ List message = registerResponse.getMessage();
+ if (message != null && message.size() > 0)
+ Toast.makeText(context, message.get(0), Toast.LENGTH_LONG).show();
+
+ } else Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ if (progressDialog != null) progressDialog.dismiss();
+ Log.e("Error", "onFailure: " + t.getMessage());
+ Toast.makeText(context, "Something went wrong!!!", Toast.LENGTH_LONG).show();
+ }
+ });
+
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventItem.java b/app/src/main/java/info/anwesha/iitp/events/EventItem.java
new file mode 100644
index 0000000..cbf3cf3
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventItem.java
@@ -0,0 +1,218 @@
+package info.anwesha.iitp.events;
+
+import androidx.annotation.Keep;
+import androidx.annotation.NonNull;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Keep
+@Entity(tableName = "events")
+public class EventItem {
+
+ @SerializedName("id")
+ @Expose
+ @NonNull
+ @PrimaryKey
+ private String id = "";
+ @SerializedName("ev_id")
+ @Expose
+ private String evId;
+ @SerializedName("ev_category")
+ @Expose
+ private String evCategory;
+ @SerializedName("ev_name")
+ @Expose
+ private String evName;
+ @SerializedName("ev_venue")
+ @Expose
+ private String evVenue;
+ @SerializedName("ev_description")
+ @Expose
+ private String evDescription;
+ @SerializedName("ev_organiser")
+ @Expose
+ private String evOrganiser;
+ @SerializedName("ev_club")
+ @Expose
+ private String evClub;
+ @SerializedName("ev_org_phone")
+ @Expose
+ private String evOrgPhone;
+ @SerializedName("ev_poster_url")
+ @Expose
+ private String evPosterUrl;
+ @SerializedName("ev_rule_book_url")
+ @Expose
+ private String evRuleBookUrl;
+ @SerializedName("ev_date")
+ @Expose
+ private String evDate;
+ @SerializedName("ev_start_time")
+ @Expose
+ private String evStartTime;
+ @SerializedName("ev_end_time")
+ @Expose
+ private String evEndTime;
+ @SerializedName("ev_amount")
+ @Expose
+ private String evAmount;
+ @SerializedName("is_team_event")
+ @Expose
+ private String isTeamEvent;
+ @SerializedName("map_url")
+ @Expose
+ private String mapUrl;
+ @SerializedName("team_members")
+ @Expose
+ private String teamMembers;
+
+ public String getEvId() {
+ return evId;
+ }
+
+ public void setEvId(String evId) {
+ this.evId = evId;
+ }
+
+ public String getEvCategory() {
+ return evCategory;
+ }
+
+ public void setEvCategory(String evCategory) {
+ this.evCategory = evCategory;
+ }
+
+ public String getEvName() {
+ return evName;
+ }
+
+ public void setEvName(String evName) {
+ this.evName = evName;
+ }
+
+ public String getEvDescription() {
+ return evDescription;
+ }
+
+ public void setEvDescription(String evDescription) {
+ this.evDescription = evDescription;
+ }
+
+ public String getEvOrganiser() {
+ return evOrganiser;
+ }
+
+ public void setEvOrganiser(String evOrganiser) {
+ this.evOrganiser = evOrganiser;
+ }
+
+ public String getEvClub() {
+ return evClub;
+ }
+
+ public void setEvClub(String evClub) {
+ this.evClub = evClub;
+ }
+
+ public String getEvOrgPhone() {
+ return evOrgPhone;
+ }
+
+ public void setEvOrgPhone(String evOrgPhone) {
+ this.evOrgPhone = evOrgPhone;
+ }
+
+ public String getEvPosterUrl() {
+ return evPosterUrl;
+ }
+
+ public void setEvPosterUrl(String evPosterUrl) {
+ this.evPosterUrl = evPosterUrl;
+ }
+
+ public String getEvRuleBookUrl() {
+ return evRuleBookUrl;
+ }
+
+ public void setEvRuleBookUrl(String evRuleBookUrl) {
+ this.evRuleBookUrl = evRuleBookUrl;
+ }
+
+ public String getEvDate() {
+ return evDate;
+ }
+
+ public void setEvDate(String evDate) {
+ this.evDate = evDate;
+ }
+
+ public String getEvStartTime() {
+ return evStartTime;
+ }
+
+ public void setEvStartTime(String evStartTime) {
+ this.evStartTime = evStartTime;
+ }
+
+ public String getEvEndTime() {
+ return evEndTime;
+ }
+
+ public void setEvEndTime(String evEndTime) {
+ this.evEndTime = evEndTime;
+ }
+
+ public String getEvVenue() {
+ return evVenue;
+ }
+
+ public void setEvVenue(String evVenue) {
+ this.evVenue = evVenue;
+ }
+
+ @NonNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(@NonNull String id) {
+ this.id = id;
+ }
+
+ public String getEvAmount() {
+ return evAmount;
+ }
+
+ public void setEvAmount(String evAmount) {
+ this.evAmount = evAmount;
+ }
+
+ public String getIsTeamEvent() {
+ return isTeamEvent;
+ }
+
+ public void setIsTeamEvent(String isTeamEvent) {
+ this.isTeamEvent = isTeamEvent;
+ }
+
+ public String getMapUrl() {
+ if (mapUrl == null || mapUrl.isEmpty())
+ return "https://www.google.com/maps/d/viewer?mid=1NVE_tnItehFaMbEWddjL786SKtuCtq4X";
+ return mapUrl;
+ }
+
+ public void setMapUrl(String mapUrl) {
+ this.mapUrl = mapUrl;
+ }
+
+ public String getTeamMembers() {
+ return teamMembers;
+ }
+
+ public void setTeamMembers(String teamMembers) {
+ this.teamMembers = teamMembers;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventsDao.java b/app/src/main/java/info/anwesha/iitp/events/EventsDao.java
new file mode 100644
index 0000000..429c0fd
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventsDao.java
@@ -0,0 +1,50 @@
+package info.anwesha.iitp.events;
+
+import androidx.lifecycle.LiveData;
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.Query;
+
+import java.util.List;
+
+import info.anwesha.iitp.events.EventItem;
+
+import static androidx.room.OnConflictStrategy.REPLACE;
+
+@Dao
+public interface EventsDao {
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Eventscollege' OR evCategory = 'Eventsall' ORDER BY evStartTime ASC")
+ LiveData> loadAllEvents();
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Exhibitions' ORDER BY evStartTime ASC")
+ LiveData> loadAllExhibitions();
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Eventsschool' ORDER BY evStartTime ASC")
+ LiveData> loadAllSchoolEvents();
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Ozone' ORDER BY evStartTime ASC")
+ LiveData> loadOzoneEvents();
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Guesttalks' ORDER BY evStartTime ASC")
+ LiveData> loadGuestTalks();
+
+ @Query("SELECT * FROM events WHERE evCategory = 'Workshops' OR evCategory = 'workshops' ORDER BY evStartTime ASC")
+ LiveData> loadWorkshops();
+
+ @Query("SELECT evClub FROM events WHERE evCategory = 'Eventscollege' OR evCategory = 'Eventsall'")
+ LiveData> loadAllClubs();
+
+ @Query("select * from events where id = :id")
+ EventItem loadEventById(String id);
+
+ @Insert(onConflict = REPLACE)
+ void insertEvent(EventItem eventItem);
+
+ @Insert(onConflict = REPLACE)
+ void insertOrReplaceEvent(EventItem... eventItems);
+
+ @Query("DELETE FROM events")
+ void deleteAllEvents();
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventsFragment.java b/app/src/main/java/info/anwesha/iitp/events/EventsFragment.java
new file mode 100644
index 0000000..bde5895
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventsFragment.java
@@ -0,0 +1,136 @@
+package info.anwesha.iitp.events;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.transition.TransitionInflater;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.network.EventsRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class EventsFragment extends Fragment {
+
+ private static final String ARG_PARAM1 = "data";
+
+ private String club;
+ private info.anwesha.iitp.events.EventsRecyclerAdapter adapter;
+ private info.anwesha.iitp.events.EventsViewModel viewModel;
+ private SwipeRefreshLayout swipeRefreshLayout;
+ private Context context;
+
+ public EventsFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ club = getArguments().getString(ARG_PARAM1);
+ }
+ viewModel = ViewModelProviders.of(this).get(EventsViewModel.class);
+
+ if (getContext() != null)
+ this.context = getContext();
+ else
+ NavHostFragment.findNavController(this).navigateUp();
+
+ setEnterTransition(TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_events, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ if (getActivity() != null)
+ ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(club + " Events");
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_events);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ RecyclerView recyclerView = view.findViewById(R.id.rv_feed_single_type);
+ recyclerView.setLayoutManager(new LinearLayoutManager(context));
+
+ adapter = new info.anwesha.iitp.events.EventsRecyclerAdapter(context, (EventsRecyclerAdapter.OnEventSelectedListener) context);
+ recyclerView.setAdapter(adapter);
+
+ observeAll();
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void observeAll() {
+ viewModel.loadAllEvents().observe(this, eventItems -> {
+ List newList = new ArrayList<>();
+ for (info.anwesha.iitp.events.EventItem n : eventItems) {
+ if (n.getEvClub().equals(club)) newList.add(n);
+ }
+ adapter.setEventItemList(newList);
+ });
+
+ }
+
+ private void updateData() {
+
+ info.anwesha.iitp.network.EventsRoutes service = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ Call> call = service.getAllEvents();
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(@NonNull Call> call, @NonNull Response> response) {
+ if (viewModel != null) {
+ if (response.isSuccessful()) {
+ viewModel.deleteEvents();
+
+ List allItems = response.body();
+
+ if (allItems != null && allItems.size() > 0) {
+ for (info.anwesha.iitp.events.EventItem newItem : allItems) {
+ viewModel.insert(newItem);
+ }
+ }
+
+ PreferenceManager.getDefaultSharedPreferences(context).edit().putLong("last_event_update_time", System.currentTimeMillis()).apply();
+
+ } else {
+ Log.e(getClass().getSimpleName(), "no data");
+ }
+ }
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+
+ @Override
+ public void onFailure(@NonNull Call> call, @NonNull Throwable t) {
+ Log.e(getClass().getSimpleName(), t.getMessage());
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventsRecyclerAdapter.java b/app/src/main/java/info/anwesha/iitp/events/EventsRecyclerAdapter.java
new file mode 100644
index 0000000..fe83599
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventsRecyclerAdapter.java
@@ -0,0 +1,115 @@
+package info.anwesha.iitp.events;
+
+
+import android.content.Context;
+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 androidx.annotation.NonNull;
+import androidx.palette.graphics.Palette;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+
+public class EventsRecyclerAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List eventItemList;
+ private OnEventSelectedListener callback;
+
+ public EventsRecyclerAdapter(Context context, OnEventSelectedListener listener) {
+ this.context = context;
+ this.callback = listener;
+ }
+
+ @NonNull
+ @Override
+ public FeedViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_events, parent, false);
+
+ return new FeedViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final FeedViewHolder holder, int position) {
+
+ if (eventItemList != null) {
+ final info.anwesha.iitp.events.EventItem current = eventItemList.get(position);
+
+ holder.title.setText(current.getEvName());
+ if (current.getEvVenue() != null)
+ holder.venue.setText(current.getEvVenue());
+ Glide.with(context)
+ .load(current.getEvPosterUrl())
+ .thumbnail(Glide.with(context).load(R.raw.load))
+ .centerCrop()
+ .into(holder.imageView);
+
+ holder.time.setText(String.format("%s - %s", current.getEvStartTime(), current.getEvEndTime()));
+ holder.venue.setText(current.getEvDate() == null ? "" : current.getEvDate());
+
+ holder.rootLayout.setOnClickListener(v -> {
+ Palette palette = Palette.from(holder.imageView.getDrawingCache()).generate();
+ Palette.Swatch swatch = palette.getDominantSwatch();
+
+ int[] color = {0,0,0};
+ if (swatch != null) {
+ color[0] = swatch.getRgb();
+ color[1] = swatch.getTitleTextColor();
+ color[2] = swatch.getBodyTextColor();
+ }
+
+ callback.onEventSelected(current.getId(), color);
+ });
+
+
+ } else {
+ holder.title.setText("Loading ...");
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (eventItemList != null)
+ return eventItemList.size();
+ else return 0;
+ }
+
+ class FeedViewHolder extends RecyclerView.ViewHolder {
+
+ View availableIndicator;
+ TextView title;
+ TextView time;
+ TextView venue;
+ LinearLayout rootLayout;
+ ImageView imageView;
+
+ FeedViewHolder(@NonNull View itemView) {
+ super(itemView);
+ availableIndicator = itemView.findViewById(R.id.item_available_indicator);
+ time = itemView.findViewById(R.id.item_time_text);
+ title = itemView.findViewById(R.id.item_title_text);
+ venue = itemView.findViewById(R.id.item_venue_text);
+ rootLayout = itemView.findViewById(R.id.item_root_layout);
+ imageView = itemView.findViewById(R.id.item_event_image);
+ imageView.setDrawingCacheEnabled(true);
+ }
+ }
+
+ public void setEventItemList(List feeds) {
+ eventItemList = feeds;
+ notifyDataSetChanged();
+ }
+
+ public interface OnEventSelectedListener {
+ void onEventSelected(String id, int[] color);
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventsRepository.java b/app/src/main/java/info/anwesha/iitp/events/EventsRepository.java
new file mode 100644
index 0000000..6a93102
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventsRepository.java
@@ -0,0 +1,118 @@
+package info.anwesha.iitp.events;
+
+import android.app.Application;
+import android.os.AsyncTask;
+
+import androidx.lifecycle.LiveData;
+
+import java.util.List;
+
+import info.anwesha.iitp.database.AppDatabase;
+
+public class EventsRepository {
+
+ private info.anwesha.iitp.events.EventsDao eventsDao;
+ private LiveData> allEvents;
+ private LiveData> allExhibitions;
+ private LiveData> allSchoolEvents;
+ private LiveData> allOzoneEvents;
+ private LiveData> allLectures;
+ private LiveData> allWorkshops;
+ private LiveData> allClubs;
+
+ public EventsRepository(Application application) {
+ info.anwesha.iitp.database.AppDatabase db = AppDatabase.getDatabase(application);
+ eventsDao = db.eventsDao();
+ allEvents = eventsDao.loadAllEvents();
+ allExhibitions = eventsDao.loadAllExhibitions();
+ allSchoolEvents = eventsDao.loadAllSchoolEvents();
+ allOzoneEvents = eventsDao.loadOzoneEvents();
+ allLectures = eventsDao.loadGuestTalks();
+ allWorkshops = eventsDao.loadWorkshops();
+ allClubs = eventsDao.loadAllClubs();
+ }
+
+ public LiveData> loadAllEvents() {
+ return allEvents;
+ }
+ public LiveData> loadAllExhibitions() {
+ return allExhibitions;
+ }
+ public LiveData> loadAllSchoolEvents() {
+ return allSchoolEvents;
+ }
+ public LiveData> loadAllOzoneEvents() {
+ return allOzoneEvents;
+ }
+ public LiveData> loadAllWorkshops() {
+ return allWorkshops;
+ }
+ public LiveData> loadAllLectures() {
+ return allLectures;
+ }
+
+ public LiveData> loadAllClubs() {
+ return allClubs;
+ }
+
+ public void insert(info.anwesha.iitp.events.EventItem eventItem) {
+ new insertAsyncTask(eventsDao).execute(eventItem);
+ }
+
+ public info.anwesha.iitp.events.EventItem loadEventById(String id) {
+ getEventById task = new getEventById(eventsDao);
+ try {
+ return task.execute(id).get();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public void deleteEvents() {
+ deleteEventsTask task = new deleteEventsTask(eventsDao);
+ task.execute();
+ }
+
+ private static class insertAsyncTask extends AsyncTask {
+ private info.anwesha.iitp.events.EventsDao mAsyncTaskDao;
+
+ insertAsyncTask(info.anwesha.iitp.events.EventsDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected Void doInBackground(final info.anwesha.iitp.events.EventItem... params) {
+ mAsyncTaskDao.insertEvent(params[0]);
+ return null;
+ }
+ }
+
+ private static class getEventById extends AsyncTask {
+ private info.anwesha.iitp.events.EventsDao mAsyncTaskDao;
+
+ getEventById(info.anwesha.iitp.events.EventsDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected EventItem doInBackground(String... params) {
+ return mAsyncTaskDao.loadEventById(params[0]);
+ }
+ }
+
+ private static class deleteEventsTask extends AsyncTask {
+ private info.anwesha.iitp.events.EventsDao mAsyncTaskDao;
+
+ deleteEventsTask(EventsDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ mAsyncTaskDao.deleteAllEvents();
+ return null;
+ }
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/events/EventsViewModel.java b/app/src/main/java/info/anwesha/iitp/events/EventsViewModel.java
new file mode 100644
index 0000000..8b49ddf
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/events/EventsViewModel.java
@@ -0,0 +1,44 @@
+package info.anwesha.iitp.events;
+
+import android.app.Application;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.AndroidViewModel;
+import androidx.lifecycle.LiveData;
+
+import java.util.List;
+
+public class EventsViewModel extends AndroidViewModel {
+
+ private info.anwesha.iitp.events.EventsRepository eventsRepository;
+ private LiveData> allEvents;
+ private LiveData> allClubs;
+
+ public EventsViewModel(@NonNull Application application) {
+ super(application);
+ eventsRepository = new EventsRepository(application);
+ allEvents = eventsRepository.loadAllEvents();
+ allClubs = eventsRepository.loadAllClubs();
+ }
+
+ LiveData> loadAllEvents() {
+ return allEvents;
+ }
+
+ public LiveData> loadAllClubs() {
+ return allClubs;
+ }
+
+ public void insert(info.anwesha.iitp.events.EventItem eventItem) {
+ eventsRepository.insert(eventItem);
+ }
+
+ public EventItem getEventById(String id) {
+ return eventsRepository.loadEventById(id);
+ }
+
+ public void deleteEvents() {
+ eventsRepository.deleteEvents();
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/gallery/Gallery.java b/app/src/main/java/info/anwesha/iitp/gallery/Gallery.java
new file mode 100644
index 0000000..2c19232
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/gallery/Gallery.java
@@ -0,0 +1,24 @@
+package info.anwesha.iitp.gallery;
+
+import androidx.annotation.Keep;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+@Keep
+public class Gallery {
+
+ @SerializedName("img")
+ @Expose
+ private List image = null;
+
+ public List getImage() {
+ return image;
+ }
+
+ public void setImage(List image) {
+ this.image = image;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/gallery/GalleryAdapter.java b/app/src/main/java/info/anwesha/iitp/gallery/GalleryAdapter.java
new file mode 100644
index 0000000..42f1e0c
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/gallery/GalleryAdapter.java
@@ -0,0 +1,80 @@
+package info.anwesha.iitp.gallery;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+
+public class GalleryAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List imageList;
+ private OnImageSelectedListener callback;
+
+ public GalleryAdapter(Context context, OnImageSelectedListener listener) {
+ this.context = context;
+ this.callback = listener;
+ }
+
+ @NonNull
+ @Override
+ public FeedViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_gallery, parent, false);
+
+ return new FeedViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final FeedViewHolder holder, int position) {
+
+ if (imageList != null) {
+ final info.anwesha.iitp.gallery.Image current = imageList.get(position);
+
+ Glide.with(context)
+ .load(current.getReduced())
+ .thumbnail(Glide.with(context).load(R.raw.load))
+ .centerCrop()
+ .into(holder.imageView);
+
+ holder.imageView.setOnClickListener(view -> {
+ callback.onEventSelected(current.getReduced(), current.getNormal());
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (imageList != null)
+ return imageList.size();
+ else return 0;
+ }
+
+ class FeedViewHolder extends RecyclerView.ViewHolder {
+
+ ImageView imageView;
+
+ FeedViewHolder(@NonNull View itemView) {
+ super(itemView);
+ imageView = itemView.findViewById(R.id.image);
+ }
+ }
+
+ void setImageList(List images) {
+ imageList = images;
+ notifyDataSetChanged();
+ }
+
+ public interface OnImageSelectedListener {
+ void onEventSelected(String reduced, String url);
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/gallery/GalleryDao.java b/app/src/main/java/info/anwesha/iitp/gallery/GalleryDao.java
new file mode 100644
index 0000000..764c35a
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/gallery/GalleryDao.java
@@ -0,0 +1,25 @@
+package info.anwesha.iitp.gallery;
+
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.Query;
+
+import java.util.List;
+
+import info.anwesha.iitp.gallery.Image;
+
+import static androidx.room.OnConflictStrategy.REPLACE;
+
+@Dao
+public interface GalleryDao {
+
+ @Query("SELECT * FROM Image")
+ List loadAllImages();
+
+ @Insert(onConflict = REPLACE)
+ void insertImage(info.anwesha.iitp.gallery.Image image);
+
+ @Query("DELETE FROM Image")
+ void deleteImages();
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/gallery/GalleryFragment.java b/app/src/main/java/info/anwesha/iitp/gallery/GalleryFragment.java
new file mode 100644
index 0000000..ae5d76e
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/gallery/GalleryFragment.java
@@ -0,0 +1,190 @@
+package info.anwesha.iitp.gallery;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.transition.TransitionInflater;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.database.AppDatabase;
+import info.anwesha.iitp.network.OtherRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import info.anwesha.iitp.utils.ImageViewerActivity;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class GalleryFragment extends Fragment implements info.anwesha.iitp.gallery.GalleryAdapter.OnImageSelectedListener {
+
+ public GalleryFragment() {
+ }
+
+ private SwipeRefreshLayout swipeRefreshLayout;
+ private Context context;
+ private info.anwesha.iitp.gallery.GalleryAdapter adapter;
+ private info.anwesha.iitp.gallery.GalleryDao dao;
+ private SharedPreferences preferences;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (getContext() != null)
+ this.context = getContext();
+ else
+ NavHostFragment.findNavController(this).navigateUp();
+
+ setEnterTransition(TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
+
+ dao = AppDatabase.getDatabase(context).galleryDao();
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_gallery, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_gallery);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ if (preferences.getLong("last_gallery_update_time", 0) < System.currentTimeMillis() - 10 * 60 * 1000) {
+ swipeRefreshLayout.setRefreshing(true);
+ updateData();
+ }
+
+ RecyclerView recyclerView = view.findViewById(R.id.recycler_gallery);
+ recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
+
+ adapter = new GalleryAdapter(context, this);
+ recyclerView.setAdapter(adapter);
+
+ populateData();
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void populateData() {
+
+ try {
+ List allImages = new GetImagesTask(dao).execute().get();
+ adapter.setImageList(allImages);
+ } catch (ExecutionException | InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ private void updateData() {
+
+ info.anwesha.iitp.network.OtherRoutes service = RetrofitClientInstance.getRetrofitInstance().create(OtherRoutes.class);
+
+ Call call = service.getImages();
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (response.isSuccessful()) {
+
+ info.anwesha.iitp.gallery.Gallery gallery = response.body();
+
+ if (gallery != null && gallery.getImage() != null) {
+ new DeleteImagesTask(dao).execute();
+
+ for (info.anwesha.iitp.gallery.Image image : gallery.getImage())
+ new InsertImageTask(dao).execute(image);
+
+ populateData();
+
+ preferences.edit().putLong("last_gallery_update_time", System.currentTimeMillis()).apply();
+ }
+
+ } else {
+ Log.e(getClass().getSimpleName(), "no data");
+ }
+
+ if (swipeRefreshLayout != null) swipeRefreshLayout.setRefreshing(false);
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ Log.e(getClass().getSimpleName(), "f, load failed");
+ if (swipeRefreshLayout != null) swipeRefreshLayout.setRefreshing(false);
+ }
+ });
+
+ }
+
+ @Override
+ public void onEventSelected(String reduced, String url) {
+ Intent i = new Intent(context, ImageViewerActivity.class);
+ i.putExtra("image_url", url);
+ i.putExtra("image_reduced", reduced);
+ startActivity(i);
+ }
+
+
+ private static class InsertImageTask extends AsyncTask {
+ private info.anwesha.iitp.gallery.GalleryDao mAsyncTaskDao;
+
+ InsertImageTask(info.anwesha.iitp.gallery.GalleryDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected Void doInBackground(final info.anwesha.iitp.gallery.Image... params) {
+ mAsyncTaskDao.insertImage(params[0]);
+ return null;
+ }
+ }
+
+ private static class GetImagesTask extends AsyncTask> {
+ private info.anwesha.iitp.gallery.GalleryDao mAsyncTaskDao;
+
+ GetImagesTask(info.anwesha.iitp.gallery.GalleryDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected List doInBackground(Void... params) {
+ return mAsyncTaskDao.loadAllImages();
+ }
+ }
+
+ private static class DeleteImagesTask extends AsyncTask {
+ private info.anwesha.iitp.gallery.GalleryDao mAsyncTaskDao;
+
+ DeleteImagesTask(GalleryDao dao) {
+ mAsyncTaskDao = dao;
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ mAsyncTaskDao.deleteImages();
+ return null;
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/gallery/Image.java b/app/src/main/java/info/anwesha/iitp/gallery/Image.java
new file mode 100644
index 0000000..b6c7143
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/gallery/Image.java
@@ -0,0 +1,48 @@
+package info.anwesha.iitp.gallery;
+
+import androidx.annotation.Keep;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Keep
+@Entity
+public class Image {
+
+ @PrimaryKey(autoGenerate = true)
+ private int id;
+ @SerializedName("normal")
+ @Expose
+ private String normal;
+ @SerializedName("reduced")
+ @Expose
+ private String reduced;
+
+ public Image() {}
+
+ public String getNormal() {
+ return normal;
+ }
+
+ public void setNormal(String normal) {
+ this.normal = normal;
+ }
+
+ public String getReduced() {
+ return reduced;
+ }
+
+ public void setReduced(String reduced) {
+ this.reduced = reduced;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/home/EventCategoryFragment.java b/app/src/main/java/info/anwesha/iitp/home/EventCategoryFragment.java
new file mode 100644
index 0000000..cb4c71f
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/home/EventCategoryFragment.java
@@ -0,0 +1,153 @@
+package info.anwesha.iitp.home;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.transition.TransitionInflater;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsViewModel;
+import info.anwesha.iitp.home.EventsCategoryAdapter;
+import info.anwesha.iitp.network.EventsRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class EventCategoryFragment extends Fragment {
+
+ public EventCategoryFragment() {
+ }
+
+ private SwipeRefreshLayout swipeRefreshLayout;
+ private EventsViewModel viewModel;
+
+ private EventsCategoryAdapter adapter;
+ private RecyclerView recyclerView;
+ private View emptyView;
+ private SharedPreferences preferences;
+
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setEnterTransition(TransitionInflater.from(requireContext()).inflateTransition(android.R.transition.fade));
+ viewModel = ViewModelProviders.of(this).get(EventsViewModel.class);
+ if (getContext() != null)
+ this.context = getContext();
+ else
+ NavHostFragment.findNavController(this).navigateUp();
+
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_event_category, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_event_cat);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ if (preferences.getLong("last_event_update_time", 0) < System.currentTimeMillis() - 10 * 60 * 1000) {
+ swipeRefreshLayout.setRefreshing(true);
+ updateData();
+ }
+
+ emptyView = view.findViewById(R.id.empty_view);
+
+ recyclerView = view.findViewById(R.id.rv_event_category);
+ recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
+
+ adapter = new EventsCategoryAdapter(context);
+ recyclerView.setAdapter(adapter);
+
+ observeAll();
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void observeAll() {
+ viewModel.loadAllClubs().observe(this, strings -> {
+
+ List temp = new ArrayList<>();
+
+ for (String s : strings)
+ if (!temp.contains(s))
+ temp.add(s);
+
+ adapter.setEventCategoryList(temp);
+
+ if (strings.size() == 0) {
+ recyclerView.setVisibility(View.INVISIBLE);
+ emptyView.setVisibility(View.VISIBLE);
+ } else {
+ recyclerView.setVisibility(View.VISIBLE);
+ emptyView.setVisibility(View.INVISIBLE);
+ }
+ });
+ }
+
+ private void updateData() {
+
+ EventsRoutes service = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ Call> call = service.getAllEvents();
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(@NonNull Call> call, @NonNull Response> response) {
+ if (viewModel != null) {
+ if (response.isSuccessful()) {
+
+ viewModel.deleteEvents();
+
+ List allItems = response.body();
+
+ if (allItems != null && allItems.size() > 0) {
+ for (EventItem newItem : allItems) {
+ viewModel.insert(newItem);
+ }
+ }
+
+ preferences.edit().putLong("last_event_update_time", System.currentTimeMillis()).apply();
+
+ } else {
+ Log.e(getClass().getSimpleName(), "no data");
+ }
+ }
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+
+ @Override
+ public void onFailure(@NonNull Call> call, @NonNull Throwable t) {
+ Log.e(getClass().getSimpleName(), t.getMessage());
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/home/EventsCategoryAdapter.java b/app/src/main/java/info/anwesha/iitp/home/EventsCategoryAdapter.java
new file mode 100644
index 0000000..a0b2d91
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/home/EventsCategoryAdapter.java
@@ -0,0 +1,86 @@
+package info.anwesha.iitp.home;
+
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.navigation.Navigation;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+
+public class EventsCategoryAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List categoryList;
+
+ public EventsCategoryAdapter(Context context) {
+ this.context = context;
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_event_category, parent, false);
+
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
+
+ if (categoryList != null) {
+ final String current = categoryList.get(position);
+
+ holder.title.setText(current);
+// Glide.with(context)
+// .load(R.raw.gif_abc)
+// .centerCrop()
+// .into(holder.imageView);
+
+ holder.rootLayout.setOnClickListener(v -> {
+ Bundle b = new Bundle();
+ b.putString("data", current);
+ Navigation.findNavController(v).navigate(R.id.nav_events, b);
+ });
+
+
+ } else {
+ holder.title.setText("Loading ...");
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (categoryList != null)
+ return categoryList.size();
+ else return 0;
+ }
+
+ class ViewHolder extends RecyclerView.ViewHolder {
+
+ TextView title;
+ View rootLayout;
+ ImageView imageView;
+
+ ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ title = itemView.findViewById(R.id.title);
+ rootLayout = itemView.findViewById(R.id.root_event_category);
+ imageView = itemView.findViewById(R.id.image);
+ }
+ }
+
+ void setEventCategoryList(List eventCategoryList) {
+ categoryList = eventCategoryList;
+ notifyDataSetChanged();
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/home/HomeFragment.java b/app/src/main/java/info/anwesha/iitp/home/HomeFragment.java
new file mode 100644
index 0000000..8c4ac4b
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/home/HomeFragment.java
@@ -0,0 +1,84 @@
+package info.anwesha.iitp.home;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.navigation.NavController;
+import androidx.navigation.Navigation;
+
+import com.bumptech.glide.Glide;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import info.anwesha.iitp.R;
+
+public class HomeFragment extends Fragment {
+
+ public HomeFragment() {
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_home, container, false);
+
+ ImageView imageView = view.findViewById(R.id.main_logo_iv);
+ Glide.with(requireContext()).load(R.drawable.celesta_logo_long_2).into(imageView);
+
+ Map map = new HashMap<>();
+
+ map.put(R.id.main_pronite_ll, R.id.nav_pronite);
+ map.put(R.id.main_event_ll, R.id.nav_events_cat);
+ map.put(R.id.main_gallery_ll, R.id.nav_gallery);
+ map.put(R.id.main_special_ll, R.id.nav_special_cat);
+ map.put(R.id.main_team_ll, R.id.nav_team);
+ map.put(R.id.main_sponsor_ll, R.id.nav_sponsors);
+
+ for (final Map.Entry pair : map.entrySet()) {
+ View mainView = view.findViewById(pair.getKey());
+ mainView.setOnClickListener(v -> {
+ if (getActivity() != null) {
+ NavController navController = Navigation.findNavController(getActivity(), R.id.nav_host_fragment);
+ navController.navigate(pair.getValue());
+ }
+ });
+ }
+
+ return view;
+ }
+
+ @Override
+ public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
+ if (getActivity() != null)
+ getActivity().getMenuInflater().inflate(R.menu.menu_home, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+
+ int id = item.getItemId();
+ if (id == R.id.action_contact) {
+ NavController navController = Navigation.findNavController(getActivity(), R.id.nav_host_fragment);
+ navController.navigate(R.id.option_contact);
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/home/MainActivity.java b/app/src/main/java/info/anwesha/iitp/home/MainActivity.java
new file mode 100644
index 0000000..80c312d
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/home/MainActivity.java
@@ -0,0 +1,233 @@
+package info.anwesha.iitp.home;
+
+import android.content.Intent;
+import android.content.IntentSender;
+import android.content.SharedPreferences;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.view.GravityCompat;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.navigation.NavController;
+import androidx.navigation.Navigation;
+import androidx.navigation.ui.AppBarConfiguration;
+import androidx.navigation.ui.NavigationUI;
+import androidx.preference.PreferenceManager;
+
+import com.bumptech.glide.Glide;
+import com.google.android.material.navigation.NavigationView;
+import com.google.android.material.snackbar.Snackbar;
+import com.google.android.play.core.appupdate.AppUpdateInfo;
+import com.google.android.play.core.appupdate.AppUpdateManager;
+import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
+import com.google.android.play.core.install.InstallState;
+import com.google.android.play.core.install.InstallStateUpdatedListener;
+import com.google.android.play.core.install.model.InstallStatus;
+import com.google.android.play.core.install.model.UpdateAvailability;
+import com.google.android.play.core.tasks.Task;
+import com.google.firebase.messaging.FirebaseMessaging;
+
+import info.anwesha.iitp.BuildConfig;
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.Auth.LoginRegisterActivity;
+import info.anwesha.iitp.events.EventDetailsFragment;
+import info.anwesha.iitp.events.EventsRecyclerAdapter;
+
+import static com.google.android.play.core.install.model.AppUpdateType.IMMEDIATE;
+
+public class MainActivity extends AppCompatActivity implements EventsRecyclerAdapter.OnEventSelectedListener {
+
+ private AppBarConfiguration mAppBarConfiguration;
+ private MenuItem navAccount;
+ private SharedPreferences prefs;
+ private NavigationView navigationView;
+ private AppUpdateManager appUpdateManager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().setBackgroundDrawableResource(R.drawable.back);
+ setContentView(R.layout.activity_main);
+
+ prefs = PreferenceManager.getDefaultSharedPreferences(this);
+
+ Toolbar toolbar = findViewById(R.id.toolbar);
+ toolbar.setTitle("");
+ setSupportActionBar(toolbar);
+
+ DrawerLayout drawer = findViewById(R.id.drawer_layout);
+ navigationView = findViewById(R.id.nav_view);
+
+ Menu menu = navigationView.getMenu();
+ navAccount = menu.findItem(R.id.nav_account);
+
+ mAppBarConfiguration = new AppBarConfiguration.Builder(
+ R.id.nav_home, R.id.nav_events_cat, R.id.nav_ongoing, R.id.nav_pronite, R.id.nav_special_cat,
+ R.id.nav_gallery, R.id.nav_team, R.id.nav_sponsors, R.id.nav_maps, R.id.nav_developers, R.id.nav_account)
+ .setDrawerLayout(drawer)
+ .build();
+
+ NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
+ NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
+ NavigationUI.setupWithNavController(navigationView, navController);
+
+ FirebaseMessaging.getInstance().subscribeToTopic("all");
+ FirebaseMessaging.getInstance().subscribeToTopic("dev");
+ }
+
+// private void handleIntent(Intent appLinkIntent) {
+// String appLinkAction = appLinkIntent.getAction();
+// String appLinkData = appLinkIntent.getDataString();
+//
+// if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData != null) {
+//
+// if (appLinkData.contains("/notification/")) {
+// String time = appLinkData.substring(appLinkData.lastIndexOf("/") + 1);
+//
+// Bundle bundle = new Bundle();
+// bundle.putString("time", time);
+//
+// }
+// }
+// }
+//
+
+ @Override
+ public boolean onSupportNavigateUp() {
+ NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
+ return NavigationUI.navigateUp(navController, mAppBarConfiguration)
+ || super.onSupportNavigateUp();
+ }
+
+ @Override
+ public void onBackPressed() {
+ DrawerLayout drawer = findViewById(R.id.drawer_layout);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ drawer.closeDrawer(GravityCompat.START);
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ @Override
+ public void onEventSelected(String id, int[] color) {
+ Bundle b = new Bundle();
+ b.putString("data", id);
+ b.putIntArray("color", color);
+
+ info.anwesha.iitp.events.EventDetailsFragment fragment = new EventDetailsFragment();
+ fragment.setArguments(b);
+ fragment.setRetainInstance(true);
+ fragment.show(getSupportFragmentManager(), fragment.getTag());
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("login_status", false))
+ navAccount.setTitle("Profile");
+ else navAccount.setTitle("Login/Register");
+
+ new Handler().postDelayed(this::updateApp, 1000);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ new Handler().postDelayed(this::populateHeaderView, 200);
+ }
+
+ private void populateHeaderView() {
+
+ View v = navigationView.getHeaderView(0);
+
+ if (v != null) {
+ String name = prefs.getString("first_name", "");
+ ((TextView) v.findViewById(R.id.name)).setText(name.isEmpty() ? "Celesta IITP" : name);
+ String id = prefs.getString("celesta_id", "");
+ ((TextView) v.findViewById(R.id.celesta_id)).setText(id.isEmpty() ? "Guest User" : id);
+ ImageView profileImage = v.findViewById(R.id.image);
+ Glide.with(this)
+ .load(prefs.getString("qr_code", ""))
+ .centerCrop()
+ .placeholder(R.mipmap.celesta_icon_round)
+ .into(profileImage);
+ profileImage.setOnClickListener(view -> startActivity(new Intent(MainActivity.this, LoginRegisterActivity.class)));
+ }
+ }
+
+ private void updateApp() {
+ Log.e(getClass().getSimpleName(), String.valueOf(BuildConfig.VERSION_CODE));
+
+ appUpdateManager = AppUpdateManagerFactory.create(this);
+ Task appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
+
+ appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
+
+ if (appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED) {
+ popupSnackBarForCompleteUpdate();
+ } else if (appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) {
+ try {
+ appUpdateManager.startUpdateFlowForResult(appUpdateInfo, IMMEDIATE, this, 1011);
+ } catch (IntentSender.SendIntentException e) {
+ e.printStackTrace();
+ }
+ } else if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && appUpdateInfo.isUpdateTypeAllowed(IMMEDIATE)) {
+ try {
+ appUpdateManager.startUpdateFlowForResult(appUpdateInfo, IMMEDIATE, this, 1011);
+ } catch (IntentSender.SendIntentException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ private InstallStateUpdatedListener updatedListener = new InstallStateUpdatedListener() {
+ @Override
+ public void onStateUpdate(InstallState installState) {
+ if (installState.installStatus() == InstallStatus.DOWNLOADED) {
+ popupSnackBarForCompleteUpdate();
+ } else if (installState.installStatus() == InstallStatus.INSTALLED) {
+ if (appUpdateManager != null) {
+ appUpdateManager.unregisterListener(updatedListener);
+ }
+ } else {
+ Log.i(getClass().getSimpleName(), "InstallStateUpdatedListener: state: " + installState.installStatus());
+ }
+ }
+ };
+
+ private void popupSnackBarForCompleteUpdate() {
+ if (findViewById(R.id.drawer_layout) != null) {
+ Snackbar snackbar = Snackbar.make(findViewById(R.id.drawer_layout),
+ "An update has just been downloaded.", Snackbar.LENGTH_INDEFINITE);
+ snackbar.setAction("INSTALL", view -> {
+ if (appUpdateManager != null)
+ appUpdateManager.completeUpdate();
+ });
+ snackbar.setActionTextColor(Color.CYAN);
+ snackbar.show();
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ if (requestCode == 1011) {
+ if (resultCode != RESULT_OK) {
+ Log.e(getClass().getSimpleName(), "onActivityResult: app download failed");
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/network/EventsRoutes.java b/app/src/main/java/info/anwesha/iitp/network/EventsRoutes.java
new file mode 100644
index 0000000..220922c
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/network/EventsRoutes.java
@@ -0,0 +1,23 @@
+package info.anwesha.iitp.network;
+
+import java.util.List;
+
+import info.anwesha.iitp.Auth.LogoutResponse;
+import info.anwesha.iitp.events.EventItem;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.http.Body;
+import retrofit2.http.GET;
+import retrofit2.http.POST;
+
+public interface EventsRoutes {
+
+ @GET("backend/admin/functions/events_api.php")
+ Call> getAllEvents();
+
+ @POST("backend/admin/functions/register_event.php")
+ Call registerSoloEvent(@Body RequestBody body);
+
+ @POST("backend/admin/functions/reg_team_event.php")
+ Call registerTeamEvent(@Body RequestBody body);
+}
diff --git a/app/src/main/java/info/anwesha/iitp/network/OtherRoutes.java b/app/src/main/java/info/anwesha/iitp/network/OtherRoutes.java
new file mode 100644
index 0000000..8b85672
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/network/OtherRoutes.java
@@ -0,0 +1,12 @@
+package info.anwesha.iitp.network;
+
+import info.anwesha.iitp.gallery.Gallery;
+import retrofit2.Call;
+import retrofit2.http.GET;
+
+public interface OtherRoutes {
+
+ @GET("gallery/gallery.json")
+ Call getImages();
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/network/RetrofitClientInstance.java b/app/src/main/java/info/anwesha/iitp/network/RetrofitClientInstance.java
new file mode 100644
index 0000000..907683a
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/network/RetrofitClientInstance.java
@@ -0,0 +1,20 @@
+package info.anwesha.iitp.network;
+
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+public class RetrofitClientInstance {
+
+ private static Retrofit retrofit;
+ private static final String BASE_URL = "https://celesta.org.in/";
+
+ public static Retrofit getRetrofitInstance() {
+ if (retrofit == null) {
+ retrofit = new Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create())
+ .build();
+ }
+ return retrofit;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/network/UserRoutes.java b/app/src/main/java/info/anwesha/iitp/network/UserRoutes.java
new file mode 100644
index 0000000..ac7ad74
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/network/UserRoutes.java
@@ -0,0 +1,26 @@
+package info.anwesha.iitp.network;
+
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.Body;
+import retrofit2.http.GET;
+import retrofit2.http.Header;
+import retrofit2.http.POST;
+
+public interface UserRoutes {
+
+ //users
+ @GET("/users")
+ Call getAllUsers(@Header("Authorization") String credentials);
+
+ @POST("/users/signIn")
+ Call login(@Body RequestBody body);
+
+ @POST("/users/signUp")
+ Call register(@Body RequestBody body);
+
+ @POST("/users/activate")
+ Call verifyOtp(@Body RequestBody body);
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/notification/FcmService.java b/app/src/main/java/info/anwesha/iitp/notification/FcmService.java
new file mode 100644
index 0000000..ecacf31
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/notification/FcmService.java
@@ -0,0 +1,122 @@
+package info.anwesha.iitp.notification;
+
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Build;
+import android.util.Log;
+
+import androidx.core.app.NotificationCompat;
+import androidx.core.app.NotificationManagerCompat;
+
+import com.bumptech.glide.Glide;
+import com.google.firebase.messaging.FirebaseMessagingService;
+import com.google.firebase.messaging.RemoteMessage;
+
+import java.util.Map;
+import java.util.concurrent.Future;
+
+import info.anwesha.iitp.R;
+
+public class FcmService extends FirebaseMessagingService {
+
+ private static final String LOG_TAG = FcmService.class.getSimpleName();
+ private int notificationId;
+
+ @Override
+ public void onMessageReceived(RemoteMessage remoteMessage) {
+
+ Log.e(LOG_TAG, "FROM: " + remoteMessage.getFrom());
+ Log.e(LOG_TAG, remoteMessage.getSentTime() + " ");
+
+ notificationId = NotificationId.getID();
+
+ Map data = remoteMessage.getData();
+
+ if (data.containsKey("notify")) {
+ if ("1".equals(data.get("notify"))) {
+
+ String imageUri;
+ String messageBody = remoteMessage.getData().get("body");
+ String messageTitle = remoteMessage.getData().get("title");
+ String link = remoteMessage.getData().get("link");
+
+ Bitmap bitmap = null;
+ if (data.containsKey("image_uri")) {
+ imageUri = remoteMessage.getData().get("image_uri");
+ Future futureTarget = Glide.with(this)
+ .asBitmap()
+ .load(imageUri)
+ .submit();
+ try {
+ bitmap = futureTarget.get();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ sendNotification(messageTitle, messageBody, bitmap, link);
+ }
+ }
+
+ }
+
+ private void sendNotification(String title, String body, Bitmap image, String link) {
+ createNotificationChannel(getApplicationContext());
+
+ String data = getResources().getString(R.string.celesta_app) + "notification";
+
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setPackage(getPackageName());
+ intent.setData(Uri.parse(data));
+
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+
+ NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
+ .setSmallIcon(R.mipmap.celesta_icon_round)
+ .setContentTitle(title)
+ .setContentText(body)
+ .setAutoCancel(true)
+ .setContentIntent(pendingIntent)
+ .setPriority(NotificationCompat.PRIORITY_MAX)
+ .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
+ .setCategory(NotificationCompat.CATEGORY_EVENT);
+
+ if (image == null) {
+ notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(body));
+ } else {
+ notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image));
+ notificationBuilder.setLargeIcon(image);
+ }
+
+ NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
+ notificationManager.notify(notificationId, notificationBuilder.build());
+
+ }
+
+ public static void createNotificationChannel(Context context) {
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ CharSequence name = "Notifications";
+ int importance = NotificationManager.IMPORTANCE_HIGH;
+ NotificationChannel channel = new NotificationChannel(context.getString(R.string.default_notification_channel_id), name, importance);
+ channel.enableLights(true);
+ channel.setLightColor(Color.BLUE);
+ channel.setDescription(context.getString(R.string.default_notification_channel_description));
+ channel.enableVibration(true);
+ channel.setShowBadge(true);
+
+ NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager != null) {
+ notificationManager.createNotificationChannel(channel);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/notification/NotificationId.java b/app/src/main/java/info/anwesha/iitp/notification/NotificationId.java
new file mode 100644
index 0000000..527a610
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/notification/NotificationId.java
@@ -0,0 +1,27 @@
+package info.anwesha.iitp.notification;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class NotificationId {
+ private final static AtomicInteger c = new AtomicInteger(0);
+ private final static AtomicInteger current_count = new AtomicInteger(0);
+
+ public static int getID() {
+ return c.incrementAndGet();
+ }
+
+ public static int getCurrentCount() {
+ return current_count.get();
+ }
+
+ public static int decrementAndGetCurrentCount() {
+ if (current_count.get() > 0)
+ return current_count.decrementAndGet();
+ else
+ return 0;
+ }
+
+ public static void setCurrentCount(int count) {
+ current_count.set(count);
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/ongoing/OngoingEventsFragment.java b/app/src/main/java/info/anwesha/iitp/ongoing/OngoingEventsFragment.java
new file mode 100644
index 0000000..bff5e83
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/ongoing/OngoingEventsFragment.java
@@ -0,0 +1,95 @@
+package info.anwesha.iitp.ongoing;
+
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.events.EventsRecyclerAdapter;
+
+public class OngoingEventsFragment extends Fragment {
+
+ private EventsRecyclerAdapter adapter;
+ private RecyclerView recyclerView;
+ private View emptyView;
+ private SwipeRefreshLayout swipeRefreshLayout;
+
+ public OngoingEventsFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_events, container, false);
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_events);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ recyclerView = view.findViewById(R.id.rv_feed_single_type);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+
+ adapter = new EventsRecyclerAdapter(requireContext(), (EventsRecyclerAdapter.OnEventSelectedListener) requireContext());
+ recyclerView.setAdapter(adapter);
+
+ updateData();
+
+ return view;
+ }
+
+
+ private void updateData() {
+
+// String token = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(USER_TOKEN, "0");
+// Log.e("token", token);
+
+// GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
+//
+// Call call = service.getNewFeed(token, latest);
+// call.enqueue(new Callback() {
+// @Override
+// public void onResponse(Call call, Response response) {
+//
+// if (response.isSuccessful()) {
+
+// List allItems = response.body().getLatestFeeds();
+//
+
+// List newList = new ArrayList<>();
+//
+// adapter.setEventItemList(newList);
+// if (newList.size() == 0) {
+// recyclerView.setVisibility(View.INVISIBLE);
+//// emptyView.setVisibility(View.VISIBLE);
+// } else {
+// recyclerView.setVisibility(View.VISIBLE);
+//// emptyView.setVisibility(View.INVISIBLE);
+// }
+//
+// }
+// swipeRefreshLayout.setRefreshing(false);
+// }
+//
+// @Override
+// public void onFailure(Call call, Throwable t) {
+// Log.e("failure", t.getMessage());
+// swipeRefreshLayout.setRefreshing(false);
+// }
+// });
+
+
+ }
+
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/pronite/ProniteFragment.java b/app/src/main/java/info/anwesha/iitp/pronite/ProniteFragment.java
new file mode 100644
index 0000000..c82c6aa
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/pronite/ProniteFragment.java
@@ -0,0 +1,90 @@
+package info.anwesha.iitp.pronite;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.cardview.widget.CardView;
+import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
+
+import com.bumptech.glide.Glide;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.utils.ImageViewerActivity;
+
+public class ProniteFragment extends Fragment {
+
+ public ProniteFragment() {
+ }
+
+ private Context context;
+ private int[] color;
+ private SharedPreferences preferences;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (getContext() != null)
+ this.context = getContext();
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_pronite, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ ImageView poster = view.findViewById(R.id.poster);
+ CardView contact = view.findViewById(R.id.card_event_details_qua);
+ Button register = view.findViewById(R.id.button_register);
+ ImageButton map = view.findViewById(R.id.button_map);
+
+ String posterUrl = "https://celesta.org.in/backend/admin/events/posters/ATM1245_Anubhav%20Singh%20Bassi.jpg";
+ Glide.with(context)
+ .asBitmap()
+ .load(posterUrl)
+ .centerCrop()
+ .into(poster);
+
+ poster.setOnClickListener(view14 -> {
+ Intent i = new Intent(context, ImageViewerActivity.class);
+ i.putExtra("image_url", posterUrl);
+ startActivity(i);
+ });
+
+
+ map.setOnClickListener(view13 -> {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(""));
+ startActivity(intent);
+ });
+
+ contact.setOnClickListener(view1 -> {
+ Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+918058501770"));
+ startActivity(intent);
+ });
+
+ register.setOnClickListener(view15 -> {
+
+ });
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/special/SpecialCategoryFragment.java b/app/src/main/java/info/anwesha/iitp/special/SpecialCategoryFragment.java
new file mode 100644
index 0000000..b76755b
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/special/SpecialCategoryFragment.java
@@ -0,0 +1,159 @@
+package info.anwesha.iitp.special;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.transition.TransitionInflater;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.navigation.Navigation;
+import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.PreferenceManager;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import com.google.android.material.card.MaterialCardView;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsViewModel;
+import info.anwesha.iitp.network.EventsRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class SpecialCategoryFragment extends Fragment implements View.OnClickListener {
+
+ public SpecialCategoryFragment() {
+ }
+
+ private SwipeRefreshLayout swipeRefreshLayout;
+
+ private SharedPreferences preferences;
+
+ private Context context;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setEnterTransition(TransitionInflater.from(requireContext()).inflateTransition(android.R.transition.fade));
+ if (getContext() != null)
+ this.context = getContext();
+ else
+ NavHostFragment.findNavController(this).navigateUp();
+
+ preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_special_category, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_event_cat);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ if (preferences.getLong("last_event_update_time", 0) < System.currentTimeMillis() - 10 * 60 * 1000) {
+ swipeRefreshLayout.setRefreshing(true);
+ updateData();
+ }
+
+ MaterialCardView schoolEvents = view.findViewById(R.id.card_school_events);
+ MaterialCardView exhibitions = view.findViewById(R.id.card_exhibitions);
+ MaterialCardView guestLectures = view.findViewById(R.id.card_lectures);
+ MaterialCardView workshops = view.findViewById(R.id.card_workshops);
+ MaterialCardView ozone = view.findViewById(R.id.card_ozone);
+
+ schoolEvents.setOnClickListener(this);
+ exhibitions.setOnClickListener(this);
+ guestLectures.setOnClickListener(this);
+ workshops.setOnClickListener(this);
+ ozone.setOnClickListener(this);
+
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void updateData() {
+
+ info.anwesha.iitp.events.EventsViewModel viewModel = ViewModelProviders.of(this).get(EventsViewModel.class);
+ info.anwesha.iitp.network.EventsRoutes service = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ Call> call = service.getAllEvents();
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(@NonNull Call> call, @NonNull Response> response) {
+ if (response.isSuccessful()) {
+
+ viewModel.deleteEvents();
+
+ List allItems = response.body();
+
+ if (allItems != null && allItems.size() > 0) {
+ for (info.anwesha.iitp.events.EventItem newItem : allItems) {
+ viewModel.insert(newItem);
+ }
+ }
+
+ preferences.edit().putLong("last_event_update_time", System.currentTimeMillis()).apply();
+
+ } else {
+ Log.e(getClass().getSimpleName(), "no data");
+ }
+
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+
+ @Override
+ public void onFailure(@NonNull Call> call, @NonNull Throwable t) {
+ Log.e(getClass().getSimpleName(), t.getMessage());
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+ });
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ Bundle b = new Bundle();
+
+ switch (view.getId()) {
+
+ case R.id.card_school_events:
+ b.putString("data", "Schoolevents");
+ break;
+ case R.id.card_exhibitions:
+ b.putString("data", "Exhibitions");
+ break;
+ case R.id.card_lectures:
+ b.putString("data", "Guesttalks");
+ break;
+ case R.id.card_workshops:
+ b.putString("data", "Workshops");
+ break;
+ case R.id.card_ozone:
+ b.putString("data", "Ozone");
+ break;
+
+ }
+
+ if (b.containsKey("data")) {
+ Navigation.findNavController(view).navigate(R.id.nav_special_events, b);
+ }
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/special/SpecialEventsFragment.java b/app/src/main/java/info/anwesha/iitp/special/SpecialEventsFragment.java
new file mode 100644
index 0000000..861ce67
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/special/SpecialEventsFragment.java
@@ -0,0 +1,157 @@
+package info.anwesha.iitp.special;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.transition.TransitionInflater;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsRecyclerAdapter;
+import info.anwesha.iitp.network.EventsRoutes;
+import info.anwesha.iitp.network.RetrofitClientInstance;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class SpecialEventsFragment extends Fragment {
+
+ private static final String ARG_PARAM1 = "data";
+
+ private String type;
+ private info.anwesha.iitp.events.EventsRecyclerAdapter adapter;
+ private info.anwesha.iitp.special.SpecialViewModel viewModel;
+ private SwipeRefreshLayout swipeRefreshLayout;
+ private Context context;
+
+ public SpecialEventsFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ type = getArguments().getString(ARG_PARAM1);
+ }
+
+ viewModel = ViewModelProviders.of(this).get(SpecialViewModel.class);
+
+ if (getContext() != null)
+ this.context = getContext();
+ else
+ NavHostFragment.findNavController(this).navigateUp();
+
+ setEnterTransition(TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_events, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ if (getActivity() != null)
+ ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(type);
+
+
+ swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_events);
+ swipeRefreshLayout.setOnRefreshListener(this::updateData);
+
+ RecyclerView recyclerView = view.findViewById(R.id.rv_feed_single_type);
+ recyclerView.setLayoutManager(new LinearLayoutManager(context));
+
+ adapter = new info.anwesha.iitp.events.EventsRecyclerAdapter(context, (EventsRecyclerAdapter.OnEventSelectedListener) context);
+ recyclerView.setAdapter(adapter);
+
+ observeAll();
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ private void observeAll() {
+ if ("Exhibitions".equals(type)) {
+ viewModel.loadAllExhibitions().observe(this, eventItems -> {
+ adapter.setEventItemList(eventItems);
+ });
+ }
+ else if ("Schoolevents".equals(type)) {
+ viewModel.loadAllSchoolEvents().observe(this, eventItems -> {
+ adapter.setEventItemList(eventItems);
+ });
+ }
+ else if ("Ozone".equals(type)) {
+ viewModel.loadAllOzoneEvents().observe(this, eventItems -> {
+ adapter.setEventItemList(eventItems);
+ });
+ }
+ else if ("Workshops".equals(type)) {
+ viewModel.loadAllWorkshops().observe(this, eventItems -> {
+ adapter.setEventItemList(eventItems);
+ });
+ }
+ else if ("Guesttalks".equals(type)) {
+ viewModel.loadAllGuestLectures().observe(this, eventItems -> {
+ adapter.setEventItemList(eventItems);
+ });
+ }
+
+ }
+
+ private void updateData() {
+
+ info.anwesha.iitp.network.EventsRoutes service = RetrofitClientInstance.getRetrofitInstance().create(EventsRoutes.class);
+
+ Call> call = service.getAllEvents();
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(@NonNull Call> call, @NonNull Response> response) {
+ if (viewModel != null) {
+ if (response.isSuccessful()) {
+ viewModel.deleteEvents();
+
+ List allItems = response.body();
+
+ if (allItems != null && allItems.size() > 0) {
+ for (info.anwesha.iitp.events.EventItem newItem : allItems) {
+ viewModel.insert(newItem);
+ }
+ }
+
+ PreferenceManager.getDefaultSharedPreferences(context).edit().putLong("last_event_update_time", System.currentTimeMillis()).apply();
+
+ } else {
+ Log.e(getClass().getSimpleName(), "no data");
+ }
+ }
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+
+ @Override
+ public void onFailure(@NonNull Call> call, @NonNull Throwable t) {
+ Log.e(getClass().getSimpleName(), t.getMessage());
+ if (swipeRefreshLayout != null)
+ swipeRefreshLayout.setRefreshing(false);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/special/SpecialViewModel.java b/app/src/main/java/info/anwesha/iitp/special/SpecialViewModel.java
new file mode 100644
index 0000000..5df6e6b
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/special/SpecialViewModel.java
@@ -0,0 +1,57 @@
+package info.anwesha.iitp.special;
+
+import android.app.Application;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.AndroidViewModel;
+import androidx.lifecycle.LiveData;
+
+import java.util.List;
+
+import info.anwesha.iitp.events.EventItem;
+import info.anwesha.iitp.events.EventsRepository;
+
+public class SpecialViewModel extends AndroidViewModel {
+
+ private info.anwesha.iitp.events.EventsRepository eventsRepository;
+ private LiveData> allExhibitions;
+ private LiveData> allOzoneEvents;
+ private LiveData> allLectures;
+ private LiveData> allSchoolEvents;
+ private LiveData> allWorkshops;
+
+ public SpecialViewModel(@NonNull Application application) {
+ super(application);
+ eventsRepository = new EventsRepository(application);
+ allExhibitions = eventsRepository.loadAllExhibitions();
+ allLectures = eventsRepository.loadAllLectures();
+ allOzoneEvents = eventsRepository.loadAllOzoneEvents();
+ allSchoolEvents = eventsRepository.loadAllSchoolEvents();
+ allWorkshops = eventsRepository.loadAllWorkshops();
+ }
+
+ LiveData> loadAllExhibitions() {
+ return allExhibitions;
+ }
+ LiveData> loadAllGuestLectures() {
+ return allLectures;
+ }
+ LiveData> loadAllOzoneEvents() {
+ return allOzoneEvents;
+ }
+ LiveData> loadAllSchoolEvents() {
+ return allSchoolEvents;
+ }
+ LiveData> loadAllWorkshops() {
+ return allWorkshops;
+ }
+
+ public void insert(EventItem eventItem) {
+ eventsRepository.insert(eventItem);
+ }
+
+ public void deleteEvents() {
+ eventsRepository.deleteEvents();
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/sponsors/SponsorItem.java b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorItem.java
new file mode 100644
index 0000000..634c639
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorItem.java
@@ -0,0 +1,45 @@
+package info.anwesha.iitp.sponsors;
+
+import androidx.annotation.Keep;
+
+@Keep
+public class SponsorItem {
+
+ private String website;
+ private String name;
+ private String image;
+
+ public SponsorItem(){
+
+ }
+
+ public SponsorItem(String name, String image, String website) {
+ this.name = name;
+ this.image = image;
+ this.website = website;
+ }
+
+ public String getWebsite() {
+ return website;
+ }
+
+ public void setWebsite(String website) {
+ this.website = website;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsAdapter.java b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsAdapter.java
new file mode 100644
index 0000000..e53354e
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsAdapter.java
@@ -0,0 +1,91 @@
+package info.anwesha.iitp.sponsors;
+
+
+import android.content.Context;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.utils.IntentUtils;
+
+public class SponsorsAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List sponsorItemList;
+
+ public SponsorsAdapter(Context context) {
+ this.context = context;
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_sponsors, parent, false);
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
+
+ if (sponsorItemList != null) {
+ final info.anwesha.iitp.sponsors.SponsorItem current = sponsorItemList.get(position);
+
+ holder.name.setText(current.getName());
+
+ Glide.with(context)
+ .load(current.getImage())
+ .thumbnail(Glide.with(context).load(R.raw.load))
+ .into(holder.image);
+
+ Log.e("image", current.getImage());
+
+ holder.root.setOnClickListener(v -> {
+
+ IntentUtils.openWebBrowser(context, current.getWebsite());
+// NavController navController = Navigation.findNavController((Activity) context, R.id.nav_host_fragment);
+// navController.navigate(pair.getValue());
+ });
+
+
+ } else {
+ holder.name.setText("Loading ...");
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (sponsorItemList != null)
+ return sponsorItemList.size();
+ else return 0;
+ }
+
+ class ViewHolder extends RecyclerView.ViewHolder {
+
+ View root;
+ TextView name;
+ ImageView image;
+
+ ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ name = itemView.findViewById(R.id.name);
+ root = itemView.findViewById(R.id.cv_sponsors);
+ image = itemView.findViewById(R.id.image);
+ }
+ }
+
+ void setSponsorItemList(List sponsors) {
+ sponsorItemList = sponsors;
+ notifyDataSetChanged();
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsFragment.java b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsFragment.java
new file mode 100644
index 0000000..631ce22
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/sponsors/SponsorsFragment.java
@@ -0,0 +1,89 @@
+package info.anwesha.iitp.sponsors;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.sponsors.SponsorItem;
+import info.anwesha.iitp.sponsors.SponsorsAdapter;
+
+public class SponsorsFragment extends Fragment {
+
+ public SponsorsFragment() {
+ }
+
+ private SponsorsAdapter adapter;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_sponsors, container, false);
+
+ RecyclerView recyclerView = view.findViewById(R.id.recycler_sponsors);
+ recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
+
+ adapter = new SponsorsAdapter(getContext());
+ recyclerView.setAdapter(adapter);
+
+ populateData();
+
+ return view;
+ }
+
+ private void populateData() {
+
+ List sponsorItems = new ArrayList<>();
+
+ sponsorItems.add(new SponsorItem("Associate Sponsor", "http://www.celesta.org.in/assets/images/sponsors/beltron.png", "http://www.rubanpatliputrahospital.com/"));
+ sponsorItems.add(new SponsorItem("Associate Sponsor", "http://www.celesta.org.in/assets/images/sponsors/ruban.png", "http://www.bihartourism.gov.in/"));
+
+ sponsorItems.add(new SponsorItem("Event Sponsor", "http://www.celesta.org.in/assets/images/sponsors/icetl.png", "http://icetl.com/"));
+ sponsorItems.add(new SponsorItem("Event Sponsor", "http://www.celesta.org.in/assets/images/sponsors/engconvo.png", "https://www.engconvo.com/"));
+ sponsorItems.add(new SponsorItem("Event Sponsor", "http://www.celesta.org.in/assets/images/sponsors/quadnation.png", "https://quadnationdrone.business.site/?utm_source=gmb&utm_medium=referral"));
+
+ sponsorItems.add(new SponsorItem("Workshop Partner", "http://www.celesta.org.in/assets/images/sponsors/techobyte.png", "https://techobytes.com/"));
+
+ sponsorItems.add(new SponsorItem("Key Partner", "http://www.celesta.org.in/assets/images/sponsors/hero.png", "https://www.heromotocorp.com/en-in/"));
+
+ sponsorItems.add(new SponsorItem("Strategic Partner", "http://www.celesta.org.in/assets/images/sponsors/startupbihar.png", "http://www.startup.bihar.gov.in/"));
+
+ sponsorItems.add(new SponsorItem("Advisory Partner", "http://www.celesta.org.in/assets/images/sponsors/eventom.png", "https://eventomindia.jimdofree.com/"));
+
+ sponsorItems.add(new SponsorItem("Hospitality Partner", "http://www.celesta.org.in/assets/images/sponsors/AmalfiGrand.png", "http://www.amalfigrand.com/"));
+
+ sponsorItems.add(new SponsorItem("Coding Partners", "http://www.celesta.org.in/assets/images/sponsors/hackerearth_new.png", "https://www.hackerearth.com"));
+
+ sponsorItems.add(new SponsorItem("Implementation Partner", "https://celesta.org.in/assets/images/sponsors/techprolabz.png", "http://www.techprolabz.com/"));
+ sponsorItems.add(new SponsorItem("Implementation Partner", "http://www.celesta.org.in/assets/images/sponsors/sybyline.png", "http://sybytech.com/"));
+ sponsorItems.add(new SponsorItem("Implementation Partner", "http://www.celesta.org.in/assets/images/sponsors/eduquis.png", "https://www.facebook.com/Eduquis-Technology-114371789937992/"));
+
+ sponsorItems.add(new SponsorItem("Beverage Partner", "http://www.celesta.org.in/assets/images/sponsors/coca.png", "https://www.coca-colaindia.com/"));
+
+ sponsorItems.add(new SponsorItem("Audio Partner", "http://www.celesta.org.in/assets/images/sponsors/zebronics2.png", "https://zebronics.com"));
+
+ sponsorItems.add(new SponsorItem("Merchandise Partner", "http://www.celesta.org.in/assets/images/sponsors/layyon.png", "http://www.layyon.com/"));
+
+ sponsorItems.add(new SponsorItem("Online Media Partner", "http://www.celesta.org.in/assets/images/sponsors/patnaites.png", "http://patnaites.com/"));
+ sponsorItems.add(new SponsorItem("Online Media Partner", "http://www.celesta.org.in/assets/images/sponsors/ABJ.png", "https://www.facebook.com/AmazingBiharJharkhand/"));
+
+ sponsorItems.add(new SponsorItem("Printing Partner", "http://www.celesta.org.in/assets/images/sponsors/eventom.png", "https://eventomindia.jimdofree.com/"));
+
+ sponsorItems.add(new SponsorItem("Gifting Partner", "http://www.celesta.org.in/assets/images/sponsors/thesouledstore.png", "https://www.thesouledstore.com/"));
+
+ sponsorItems.add(new SponsorItem("Online Savings Partner", "http://www.celesta.org.in/assets/images/sponsors/grabon.png", "https://www.grabon.in/"));
+
+ sponsorItems.add(new SponsorItem("Privilege Partner", "http://www.celesta.org.in/assets/images/sponsors/swiggy.png", "https://www.swiggy.com/"));
+
+ adapter.setSponsorItemList(sponsorItems);
+
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/team/TeamFragment.java b/app/src/main/java/info/anwesha/iitp/team/TeamFragment.java
new file mode 100644
index 0000000..a119b35
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/team/TeamFragment.java
@@ -0,0 +1,62 @@
+package info.anwesha.iitp.team;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.anwesha.iitp.R;
+
+public class TeamFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_team, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+
+ RecyclerView recyclerView = view.findViewById(R.id.recycler_team);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+
+ info.anwesha.iitp.team.TeamRecyclerAdapter adapter = new TeamRecyclerAdapter(getContext());
+ recyclerView.setAdapter(adapter);
+
+ List allMembers = new ArrayList<>();
+
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Rakshit Maheshwari", "Overall Fest Coordinator", "9939512017", "https://www.facebook.com/rakshitm123", R.drawable.rakshit_circle2));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Priyansh Singh Rao", "Coordinator - Media and Public Relations", "8058501770", "https://www.facebook.com/priyansh.rao.56", R.drawable.psr_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Roushan Kumar", "Coordinator - Marketing and Sponsorship", "9610098566", "https://www.facebook.com/CelestaIITP/", R.drawable.roushan_c));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Aman Deep", "Coordinator - Media and Public Relations", "9931059201", "https://www.facebook.com/adeep02", R.drawable.aman_deep_c));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Piyush Tiwari", "Coordinator - Events and Operations", "9834943057", "https://www.facebook.com/thebackpropogator", R.drawable.piytwr_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Mohit Kishore", "Coordinator - Events and Operations", "9570566557", "https://www.facebook.com/originalmk7", R.drawable.mohit_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Vatsal Singhal", "Coordinator - Development Team", "8585992062", "https://www.facebook.com/vatsalsinghal1", R.drawable.vatsal_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Deepanjan Datta", "Coordinator - Development Team", "7044170063", "https://www.facebook.com/deepanjan05", R.drawable.deepanjan_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Srikar Nayak", "Coordinator - Creatives And Design", "9666663764", "https://www.facebook.com/srikar.nayak.12", R.drawable.srikar_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Shubham Mondal", "Coordinator - Creatives And Design", "8967654843", "https://www.facebook.com/subham.mondal.7547031", R.drawable.shubham_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Raghu Vamsi", "Coordinator - Creatives And Design", "9705471944", "https://www.facebook.com/veerapaneni.raghuvamsi", R.drawable.raghu_c));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Prateek Rai", "Coordinator - Management And Planning", "7222998383", "https://www.facebook.com/profile.php?id=100019405147477", R.drawable.prai_c));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Yashwanth Chowdhary", "Coordinator - Management And Planning", "9182994302", "https://www.facebook.com/yaswanthchowdary.muppalla.7", R.drawable.yashwanth_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Rama Krishna", "Coordinator - Management And Planning", "8985265942", "https://www.facebook.com/ramakrishna.rapelly", R.drawable.rama_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Pranshu Chandani", "Coordinator - Hospitality", "8791838088", "https://www.facebook.com/pranshu.chandani.5", R.drawable.pranshu_c1));
+// allMembers.add(new TeamItem("Vineet Mishra", "Coordinator - Hospitality", "7355154998", "", R.drawable.vineet_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Nikhil Bommera", "Coordinator - Hospitality", "6205559807", "https://www.facebook.com/nikhil.bommera.520", R.drawable.nikhil_c1));
+ allMembers.add(new info.anwesha.iitp.team.TeamItem("Manoj Kumar", "Coordinator - Registrations And Security", "8328864643", "https://www.facebook.com/profile.php?id=100007306956302", R.drawable.manoj_c1));
+ allMembers.add(new TeamItem("Aditya Ranjan", "Coordinator - Registrations And Security", "8271572990", "https://www.facebook.com/adityaranjan04", R.drawable.aditya_ranjan_c1));
+
+ adapter.setTeamItemList(allMembers);
+
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/team/TeamItem.java b/app/src/main/java/info/anwesha/iitp/team/TeamItem.java
new file mode 100644
index 0000000..dd94625
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/team/TeamItem.java
@@ -0,0 +1,63 @@
+package info.anwesha.iitp.team;
+
+import androidx.annotation.Keep;
+
+@Keep
+public class TeamItem {
+
+ private String name;
+ private int image;
+ private String post;
+ private String phone;
+ private String facebook;
+
+ public TeamItem() {}
+
+ public TeamItem(String name, String post, String phone, String facebook, int image) {
+ this.name = name;
+ this.post = post;
+ this.phone = phone;
+ this.facebook = facebook;
+ this.image = image;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getImage() {
+ return image;
+ }
+
+ public void setImage(int image) {
+ this.image = image;
+ }
+
+ public String getPost() {
+ return post;
+ }
+
+ public void setPost(String post) {
+ this.post = post;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getFacebook() {
+ return facebook;
+ }
+
+ public void setFacebook(String facebook) {
+ this.facebook = facebook;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/team/TeamRecyclerAdapter.java b/app/src/main/java/info/anwesha/iitp/team/TeamRecyclerAdapter.java
new file mode 100644
index 0000000..6558557
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/team/TeamRecyclerAdapter.java
@@ -0,0 +1,95 @@
+package info.anwesha.iitp.team;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.cardview.widget.CardView;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+
+import java.util.List;
+
+import info.anwesha.iitp.R;
+import info.anwesha.iitp.team.TeamItem;
+import info.anwesha.iitp.utils.IntentUtils;
+
+public class TeamRecyclerAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List teamItemList;
+
+ public TeamRecyclerAdapter(Context context) {
+ this.context = context;
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_team, parent, false);
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
+
+ if (teamItemList != null) {
+ final TeamItem current = teamItemList.get(position);
+
+ holder.name.setText(current.getName());
+ holder.post.setText(current.getPost());
+ Glide.with(context)
+ .load(current.getImage())
+ .thumbnail(Glide.with(context).load(R.raw.load))
+ .centerCrop()
+ .into(holder.image);
+
+ holder.facebook.setOnClickListener(v -> IntentUtils.openWebBrowser(context, current.getFacebook()));
+ holder.phone.setOnClickListener(v -> {
+ Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + current.getPhone()));
+ context.startActivity(i);
+ });
+
+ } else {
+ holder.name.setText("Loading ...");
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ if (teamItemList != null)
+ return teamItemList.size();
+ else return 0;
+ }
+
+ class ViewHolder extends RecyclerView.ViewHolder {
+
+ TextView name;
+ TextView post;
+ CardView facebook;
+ CardView phone;
+ ImageView image;
+
+ ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ name = itemView.findViewById(R.id.name);
+ post = itemView.findViewById(R.id.post);
+ facebook = itemView.findViewById(R.id.card_facebook);
+ phone = itemView.findViewById(R.id.card_call);
+ image = itemView.findViewById(R.id.image);
+ }
+ }
+
+ public void setTeamItemList(List feeds) {
+ teamItemList = feeds;
+ notifyDataSetChanged();
+ }
+
+}
diff --git a/app/src/main/java/info/anwesha/iitp/utils/CheckNetwork.java b/app/src/main/java/info/anwesha/iitp/utils/CheckNetwork.java
new file mode 100644
index 0000000..16a52d8
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/CheckNetwork.java
@@ -0,0 +1,17 @@
+package info.anwesha.iitp.utils;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+public class CheckNetwork {
+ //Function that returns whether the phone is connected to internet or not
+ public static boolean isNetworkConnected(Context context) {
+ ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (cm != null) {
+ NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
+ return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
+ }
+ return false;
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/utils/Converters.java b/app/src/main/java/info/anwesha/iitp/utils/Converters.java
new file mode 100644
index 0000000..32a11d1
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/Converters.java
@@ -0,0 +1,30 @@
+package info.anwesha.iitp.utils;
+
+import androidx.room.TypeConverter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Converters {
+
+ @TypeConverter
+ public static String stringFromArray(List strings) {
+ if (strings != null) {
+ StringBuilder string = new StringBuilder();
+ for (String s : strings) string.append(s).append(",");
+
+ return string.toString();
+ }
+ return "";
+ }
+
+ @TypeConverter
+ public static List arrayFromString(String concatenatedStrings) {
+
+ if (concatenatedStrings != null) {
+ return new ArrayList<>(Arrays.asList(concatenatedStrings.split(",")));
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/anwesha/iitp/utils/ImageViewerActivity.java b/app/src/main/java/info/anwesha/iitp/utils/ImageViewerActivity.java
new file mode 100644
index 0000000..2daa618
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/ImageViewerActivity.java
@@ -0,0 +1,40 @@
+package info.anwesha.iitp.utils;
+
+import android.os.Bundle;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.bumptech.glide.Glide;
+
+import info.anwesha.iitp.R;
+
+public class ImageViewerActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_image_viewer);
+
+ final ImageView image = findViewById(R.id.image);
+
+ if (getIntent().hasExtra("image_url") && getIntent().hasExtra("image_reduced")) {
+ String url = getIntent().getStringExtra("image_url");
+ Glide.with(this)
+ .load(url)
+ .thumbnail(Glide.with(this).load(getIntent().getStringExtra("image_reduced")))
+ .into(image);
+
+ } else if (getIntent().hasExtra("image_url")) {
+ String url = getIntent().getStringExtra("image_url");
+ Glide.with(this)
+ .load(url)
+ .placeholder(R.drawable.logo_alt)
+ .into(image);
+
+ } else {
+ Toast.makeText(this, "No image found!!!", Toast.LENGTH_LONG).show();
+ }
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/utils/IntentUtils.java b/app/src/main/java/info/anwesha/iitp/utils/IntentUtils.java
new file mode 100644
index 0000000..08ee9c9
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/IntentUtils.java
@@ -0,0 +1,84 @@
+package info.anwesha.iitp.utils;
+
+import android.app.Activity;
+import android.app.SearchManager;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import androidx.annotation.Nullable;
+
+public class IntentUtils {
+
+ public static boolean openWebBrowser(Context context, String url) {
+ Uri page = Uri.parse(url);
+ Intent intent = new Intent(Intent.ACTION_VIEW, page);
+ return safeOpenIntent(context, intent);
+ }
+
+ public static boolean writeMail(Context context, String subject, String... recipientEmails) {
+
+ Intent intent = new Intent(Intent.ACTION_SENDTO);
+ intent.setData(Uri.parse("mailto:"));
+ intent.putExtra(Intent.EXTRA_EMAIL, recipientEmails);
+ intent.putExtra(Intent.EXTRA_SUBJECT, subject);
+ return safeOpenIntent(context, intent);
+ }
+
+ public static boolean openMap(Context context, String lat, String lng, @Nullable Float zoom) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ StringBuilder query = new StringBuilder();
+ query.append(lat).append(",").append(lng);
+
+ if (zoom != null) {
+ query.append("?z=").append(zoom);
+ }
+ Uri geoLocation = Uri.parse("geo:" + query.toString());
+ intent.setData(geoLocation);
+ return safeOpenIntent(context, intent);
+ }
+
+ public static boolean openMap(Context context, String lat, String lng, boolean showLocationPin) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ if (showLocationPin) {
+ Uri geoLocation = Uri.parse("geo:0,0?q=" + lat + "," + lng);
+ intent.setData(geoLocation);
+ return safeOpenIntent(context, intent);
+ } else {
+ return openMap(context, lat, lng, null);
+ }
+
+ }
+
+ public static boolean openMapAtAddress(Context context, String address) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ String encodedAddress = Uri.encode(address);
+ Uri geoLocation = Uri.parse("geo:0,0?q=" + encodedAddress);
+ intent.setData(geoLocation);
+ return safeOpenIntent(context, intent);
+ }
+
+ public static boolean openWebSearch(Context context, String query) {
+ Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
+ intent.putExtra(SearchManager.QUERY, query);
+ return safeOpenIntent(context, intent);
+ }
+
+ private static boolean safeOpenForResultIntent(Activity activity, Intent intent, int requestCode) {
+ if (intent.resolveActivity(activity.getPackageManager()) != null) {
+ activity.startActivityForResult(intent, requestCode);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static boolean safeOpenIntent(Context context, Intent intent) {
+ if (intent.resolveActivity(context.getPackageManager()) != null) {
+ context.startActivity(intent);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/utils/Keyboard.java b/app/src/main/java/info/anwesha/iitp/utils/Keyboard.java
new file mode 100644
index 0000000..c571831
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/Keyboard.java
@@ -0,0 +1,13 @@
+package info.anwesha.iitp.utils;
+
+import android.content.Context;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+
+public class Keyboard {
+ public static void closeKeyboard(View view, Context context) {
+ InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (inputManager != null)
+ inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.SHOW_FORCED);
+ }
+}
diff --git a/app/src/main/java/info/anwesha/iitp/utils/ViewUtils.java b/app/src/main/java/info/anwesha/iitp/utils/ViewUtils.java
new file mode 100644
index 0000000..ab9bb47
--- /dev/null
+++ b/app/src/main/java/info/anwesha/iitp/utils/ViewUtils.java
@@ -0,0 +1,20 @@
+package info.anwesha.iitp.utils;
+
+import android.graphics.Point;
+import android.view.View;
+
+public class ViewUtils {
+
+ public static Point getViewCenter(View view) {
+ if (view == null) {
+ return new Point();
+ }
+
+ int[] location = new int[2];
+ view.getLocationOnScreen(location);
+ int x = location[0] + view.getWidth() / 2;
+ int y = location[1] + view.getHeight() / 2;
+ return new Point(x, y);
+ }
+
+}
diff --git a/app/src/main/res/drawable-v24/bg_edit_text.xml b/app/src/main/res/drawable-v24/bg_edit_text.xml
new file mode 100644
index 0000000..a134281
--- /dev/null
+++ b/app/src/main/res/drawable-v24/bg_edit_text.xml
@@ -0,0 +1,20 @@
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/aditya_ranjan_c1.png b/app/src/main/res/drawable/aditya_ranjan_c1.png
new file mode 100644
index 0000000..0f53d82
Binary files /dev/null and b/app/src/main/res/drawable/aditya_ranjan_c1.png differ
diff --git a/app/src/main/res/drawable/aman_deep_c.png b/app/src/main/res/drawable/aman_deep_c.png
new file mode 100644
index 0000000..714e448
Binary files /dev/null and b/app/src/main/res/drawable/aman_deep_c.png differ
diff --git a/app/src/main/res/drawable/back.jpg b/app/src/main/res/drawable/back.jpg
new file mode 100644
index 0000000..7d01001
Binary files /dev/null and b/app/src/main/res/drawable/back.jpg differ
diff --git a/app/src/main/res/drawable/bihartourism.jpg b/app/src/main/res/drawable/bihartourism.jpg
new file mode 100644
index 0000000..5858de1
Binary files /dev/null and b/app/src/main/res/drawable/bihartourism.jpg differ
diff --git a/app/src/main/res/drawable/celesta_logo_long_2.png b/app/src/main/res/drawable/celesta_logo_long_2.png
new file mode 100644
index 0000000..07fb566
Binary files /dev/null and b/app/src/main/res/drawable/celesta_logo_long_2.png differ
diff --git a/app/src/main/res/drawable/deepanjan_c1.png b/app/src/main/res/drawable/deepanjan_c1.png
new file mode 100644
index 0000000..7c9410a
Binary files /dev/null and b/app/src/main/res/drawable/deepanjan_c1.png differ
diff --git a/app/src/main/res/drawable/developer_android.xml b/app/src/main/res/drawable/developer_android.xml
new file mode 100644
index 0000000..c248304
--- /dev/null
+++ b/app/src/main/res/drawable/developer_android.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/events_icon_2.png b/app/src/main/res/drawable/events_icon_2.png
new file mode 100644
index 0000000..b5f936c
Binary files /dev/null and b/app/src/main/res/drawable/events_icon_2.png differ
diff --git a/app/src/main/res/drawable/events_special.xml b/app/src/main/res/drawable/events_special.xml
new file mode 100644
index 0000000..274ac3b
--- /dev/null
+++ b/app/src/main/res/drawable/events_special.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/facebook.xml b/app/src/main/res/drawable/facebook.xml
new file mode 100644
index 0000000..6b2fa5b
--- /dev/null
+++ b/app/src/main/res/drawable/facebook.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/github_circle.xml b/app/src/main/res/drawable/github_circle.xml
new file mode 100644
index 0000000..28cfff5
--- /dev/null
+++ b/app/src/main/res/drawable/github_circle.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/gradient_horizontal.xml b/app/src/main/res/drawable/gradient_horizontal.xml
new file mode 100644
index 0000000..35f1619
--- /dev/null
+++ b/app/src/main/res/drawable/gradient_horizontal.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/gradient_vertical.xml b/app/src/main/res/drawable/gradient_vertical.xml
new file mode 100644
index 0000000..2854e85
--- /dev/null
+++ b/app/src/main/res/drawable/gradient_vertical.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_gallery.xml b/app/src/main/res/drawable/ic_gallery.xml
new file mode 100644
index 0000000..0d8d503
--- /dev/null
+++ b/app/src/main/res/drawable/ic_gallery.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml
new file mode 100644
index 0000000..70fb291
--- /dev/null
+++ b/app/src/main/res/drawable/ic_home.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_instagram.xml b/app/src/main/res/drawable/ic_instagram.xml
new file mode 100644
index 0000000..9256b83
--- /dev/null
+++ b/app/src/main/res/drawable/ic_instagram.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_keyboard_arrow_right_black_24dp.xml b/app/src/main/res/drawable/ic_keyboard_arrow_right_black_24dp.xml
new file mode 100644
index 0000000..a3d1622
--- /dev/null
+++ b/app/src/main/res/drawable/ic_keyboard_arrow_right_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_linkedin.xml b/app/src/main/res/drawable/ic_linkedin.xml
new file mode 100644
index 0000000..f15fd39
--- /dev/null
+++ b/app/src/main/res/drawable/ic_linkedin.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_local_phone_black_24dp.xml b/app/src/main/res/drawable/ic_local_phone_black_24dp.xml
new file mode 100644
index 0000000..ff39d8f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_local_phone_black_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_location.xml b/app/src/main/res/drawable/ic_location.xml
new file mode 100644
index 0000000..0e17521
--- /dev/null
+++ b/app/src/main/res/drawable/ic_location.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_login.xml b/app/src/main/res/drawable/ic_login.xml
new file mode 100644
index 0000000..dda5c85
--- /dev/null
+++ b/app/src/main/res/drawable/ic_login.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_map.xml b/app/src/main/res/drawable/ic_map.xml
new file mode 100644
index 0000000..b9bacc8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_map.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_ongoing.xml b/app/src/main/res/drawable/ic_ongoing.xml
new file mode 100644
index 0000000..4771118
--- /dev/null
+++ b/app/src/main/res/drawable/ic_ongoing.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_pronite.xml b/app/src/main/res/drawable/ic_pronite.xml
new file mode 100644
index 0000000..211b14b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_pronite.xml
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_sponsor.xml b/app/src/main/res/drawable/ic_sponsor.xml
new file mode 100644
index 0000000..d198dd1
--- /dev/null
+++ b/app/src/main/res/drawable/ic_sponsor.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_team.xml b/app/src/main/res/drawable/ic_team.xml
new file mode 100644
index 0000000..b28c230
--- /dev/null
+++ b/app/src/main/res/drawable/ic_team.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_theme_black_24dp.xml b/app/src/main/res/drawable/ic_theme_black_24dp.xml
new file mode 100644
index 0000000..56665e6
--- /dev/null
+++ b/app/src/main/res/drawable/ic_theme_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_twitter.xml b/app/src/main/res/drawable/ic_twitter.xml
new file mode 100644
index 0000000..ae08ca6
--- /dev/null
+++ b/app/src/main/res/drawable/ic_twitter.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_youtube.xml b/app/src/main/res/drawable/ic_youtube.xml
new file mode 100644
index 0000000..e7d7f39
--- /dev/null
+++ b/app/src/main/res/drawable/ic_youtube.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logo_alt.png b/app/src/main/res/drawable/logo_alt.png
new file mode 100644
index 0000000..9c245af
Binary files /dev/null and b/app/src/main/res/drawable/logo_alt.png differ
diff --git a/app/src/main/res/drawable/manoj_c1.png b/app/src/main/res/drawable/manoj_c1.png
new file mode 100644
index 0000000..0d577a9
Binary files /dev/null and b/app/src/main/res/drawable/manoj_c1.png differ
diff --git a/app/src/main/res/drawable/mohit_c1.png b/app/src/main/res/drawable/mohit_c1.png
new file mode 100644
index 0000000..ef57a63
Binary files /dev/null and b/app/src/main/res/drawable/mohit_c1.png differ
diff --git a/app/src/main/res/drawable/nikhil_c1.png b/app/src/main/res/drawable/nikhil_c1.png
new file mode 100644
index 0000000..e6ebcff
Binary files /dev/null and b/app/src/main/res/drawable/nikhil_c1.png differ
diff --git a/app/src/main/res/drawable/piytwr_c1.png b/app/src/main/res/drawable/piytwr_c1.png
new file mode 100644
index 0000000..33e1a01
Binary files /dev/null and b/app/src/main/res/drawable/piytwr_c1.png differ
diff --git a/app/src/main/res/drawable/prai_c.png b/app/src/main/res/drawable/prai_c.png
new file mode 100644
index 0000000..ae21a2a
Binary files /dev/null and b/app/src/main/res/drawable/prai_c.png differ
diff --git a/app/src/main/res/drawable/pranshu_c1.png b/app/src/main/res/drawable/pranshu_c1.png
new file mode 100644
index 0000000..359e57c
Binary files /dev/null and b/app/src/main/res/drawable/pranshu_c1.png differ
diff --git a/app/src/main/res/drawable/psr_c1.png b/app/src/main/res/drawable/psr_c1.png
new file mode 100644
index 0000000..841318a
Binary files /dev/null and b/app/src/main/res/drawable/psr_c1.png differ
diff --git a/app/src/main/res/drawable/raghu_c.png b/app/src/main/res/drawable/raghu_c.png
new file mode 100644
index 0000000..220c3b0
Binary files /dev/null and b/app/src/main/res/drawable/raghu_c.png differ
diff --git a/app/src/main/res/drawable/rakshit_circle2.png b/app/src/main/res/drawable/rakshit_circle2.png
new file mode 100644
index 0000000..50c48b1
Binary files /dev/null and b/app/src/main/res/drawable/rakshit_circle2.png differ
diff --git a/app/src/main/res/drawable/rama_c1.png b/app/src/main/res/drawable/rama_c1.png
new file mode 100644
index 0000000..77bc40c
Binary files /dev/null and b/app/src/main/res/drawable/rama_c1.png differ
diff --git a/app/src/main/res/drawable/rounded_button.xml b/app/src/main/res/drawable/rounded_button.xml
new file mode 100644
index 0000000..1d5f90b
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_button.xml
@@ -0,0 +1,11 @@
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/roushan_c.png b/app/src/main/res/drawable/roushan_c.png
new file mode 100644
index 0000000..2e520aa
Binary files /dev/null and b/app/src/main/res/drawable/roushan_c.png differ
diff --git a/app/src/main/res/drawable/shape_modal_bottom.xml b/app/src/main/res/drawable/shape_modal_bottom.xml
new file mode 100644
index 0000000..18c3eed
--- /dev/null
+++ b/app/src/main/res/drawable/shape_modal_bottom.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shubham_c1.png b/app/src/main/res/drawable/shubham_c1.png
new file mode 100644
index 0000000..54d7e51
Binary files /dev/null and b/app/src/main/res/drawable/shubham_c1.png differ
diff --git a/app/src/main/res/drawable/srikar_c1.png b/app/src/main/res/drawable/srikar_c1.png
new file mode 100644
index 0000000..d3987d5
Binary files /dev/null and b/app/src/main/res/drawable/srikar_c1.png differ
diff --git a/app/src/main/res/drawable/vatsal_c1.png b/app/src/main/res/drawable/vatsal_c1.png
new file mode 100644
index 0000000..8a5f7c5
Binary files /dev/null and b/app/src/main/res/drawable/vatsal_c1.png differ
diff --git a/app/src/main/res/drawable/yashwanth_c1.png b/app/src/main/res/drawable/yashwanth_c1.png
new file mode 100644
index 0000000..90e79a7
Binary files /dev/null and b/app/src/main/res/drawable/yashwanth_c1.png differ
diff --git a/app/src/main/res/layout/activity_image_viewer.xml b/app/src/main/res/layout/activity_image_viewer.xml
new file mode 100644
index 0000000..1716076
--- /dev/null
+++ b/app/src/main/res/layout/activity_image_viewer.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_login_signup.xml b/app/src/main/res/layout/activity_login_signup.xml
new file mode 100644
index 0000000..79e5712
--- /dev/null
+++ b/app/src/main/res/layout/activity_login_signup.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..1e3b336
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/card_event_category.xml b/app/src/main/res/layout/card_event_category.xml
new file mode 100644
index 0000000..aca83c3
--- /dev/null
+++ b/app/src/main/res/layout/card_event_category.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/card_events.xml b/app/src/main/res/layout/card_events.xml
new file mode 100644
index 0000000..cc64d93
--- /dev/null
+++ b/app/src/main/res/layout/card_events.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_gallery.xml b/app/src/main/res/layout/card_gallery.xml
new file mode 100644
index 0000000..a2033bd
--- /dev/null
+++ b/app/src/main/res/layout/card_gallery.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_registered_events.xml b/app/src/main/res/layout/card_registered_events.xml
new file mode 100644
index 0000000..a4f2ee5
--- /dev/null
+++ b/app/src/main/res/layout/card_registered_events.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_sponsors.xml b/app/src/main/res/layout/card_sponsors.xml
new file mode 100644
index 0000000..2e489fd
--- /dev/null
+++ b/app/src/main/res/layout/card_sponsors.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_team.xml b/app/src/main/res/layout/card_team.xml
new file mode 100644
index 0000000..9410dbb
--- /dev/null
+++ b/app/src/main/res/layout/card_team.xml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
new file mode 100644
index 0000000..bb3f843
--- /dev/null
+++ b/app/src/main/res/layout/content_main.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/src/main/res/layout/dialog_register_team_event.xml b/app/src/main/res/layout/dialog_register_team_event.xml
new file mode 100644
index 0000000..b01b4df
--- /dev/null
+++ b/app/src/main/res/layout/dialog_register_team_event.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/empty_view.xml b/app/src/main/res/layout/empty_view.xml
new file mode 100644
index 0000000..f6038d9
--- /dev/null
+++ b/app/src/main/res/layout/empty_view.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml
new file mode 100644
index 0000000..80b539f
--- /dev/null
+++ b/app/src/main/res/layout/fragment_about.xml
@@ -0,0 +1,438 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_contact_us.xml b/app/src/main/res/layout/fragment_contact_us.xml
new file mode 100644
index 0000000..df81499
--- /dev/null
+++ b/app/src/main/res/layout/fragment_contact_us.xml
@@ -0,0 +1,484 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_event_category.xml b/app/src/main/res/layout/fragment_event_category.xml
new file mode 100644
index 0000000..1861b0c
--- /dev/null
+++ b/app/src/main/res/layout/fragment_event_category.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_event_details.xml b/app/src/main/res/layout/fragment_event_details.xml
new file mode 100644
index 0000000..cd58e1d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_event_details.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_events.xml b/app/src/main/res/layout/fragment_events.xml
new file mode 100644
index 0000000..a657763
--- /dev/null
+++ b/app/src/main/res/layout/fragment_events.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_gallery.xml b/app/src/main/res/layout/fragment_gallery.xml
new file mode 100644
index 0000000..9b56db0
--- /dev/null
+++ b/app/src/main/res/layout/fragment_gallery.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
new file mode 100644
index 0000000..ce10cfa
--- /dev/null
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml
new file mode 100644
index 0000000..2b2098e
--- /dev/null
+++ b/app/src/main/res/layout/fragment_login.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml
new file mode 100644
index 0000000..b5b79fb
--- /dev/null
+++ b/app/src/main/res/layout/fragment_profile.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_pronite.xml b/app/src/main/res/layout/fragment_pronite.xml
new file mode 100644
index 0000000..8836ddf
--- /dev/null
+++ b/app/src/main/res/layout/fragment_pronite.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_register.xml b/app/src/main/res/layout/fragment_register.xml
new file mode 100644
index 0000000..87264a0
--- /dev/null
+++ b/app/src/main/res/layout/fragment_register.xml
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_resend_activation.xml b/app/src/main/res/layout/fragment_resend_activation.xml
new file mode 100644
index 0000000..0281522
--- /dev/null
+++ b/app/src/main/res/layout/fragment_resend_activation.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_special_category.xml b/app/src/main/res/layout/fragment_special_category.xml
new file mode 100644
index 0000000..436de48
--- /dev/null
+++ b/app/src/main/res/layout/fragment_special_category.xml
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_sponsors.xml b/app/src/main/res/layout/fragment_sponsors.xml
new file mode 100644
index 0000000..8f359c6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_sponsors.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_team.xml b/app/src/main/res/layout/fragment_team.xml
new file mode 100644
index 0000000..82c7c6d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_team.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml
new file mode 100644
index 0000000..28167c7
--- /dev/null
+++ b/app/src/main/res/layout/nav_header_main.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
new file mode 100644
index 0000000..112c12c
--- /dev/null
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -0,0 +1,68 @@
+
+
diff --git a/app/src/main/res/menu/menu_home.xml b/app/src/main/res/menu/menu_home.xml
new file mode 100644
index 0000000..6d4bb73
--- /dev/null
+++ b/app/src/main/res/menu/menu_home.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/celesta_icon_round.png b/app/src/main/res/mipmap-hdpi/celesta_icon_round.png
new file mode 100644
index 0000000..0fb17c1
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/celesta_icon_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/celesta_icon_round.png b/app/src/main/res/mipmap-mdpi/celesta_icon_round.png
new file mode 100644
index 0000000..8515dea
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/celesta_icon_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/celesta_icon_round.png b/app/src/main/res/mipmap-xhdpi/celesta_icon_round.png
new file mode 100644
index 0000000..286775f
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/celesta_icon_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/celesta_icon_round.png b/app/src/main/res/mipmap-xxhdpi/celesta_icon_round.png
new file mode 100644
index 0000000..b44d379
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/celesta_icon_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/celesta_icon_round.png b/app/src/main/res/mipmap-xxxhdpi/celesta_icon_round.png
new file mode 100644
index 0000000..5468c82
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/celesta_icon_round.png differ
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
new file mode 100644
index 0000000..d8a4a77
--- /dev/null
+++ b/app/src/main/res/navigation/mobile_navigation.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/raw/load.gif b/app/src/main/res/raw/load.gif
new file mode 100644
index 0000000..06c6ab6
Binary files /dev/null and b/app/src/main/res/raw/load.gif differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..0c04e78
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,19 @@
+
+
+ #EEEEEE
+ #738485
+
+ #888888
+ #4eb8dd
+ #C0C0C0
+
+ #55738485
+
+ #ffffff
+ #000000
+ #00000000
+
+ #aa646B6D
+ #661E263F
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..1b43149
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,4 @@
+
+
+ 176dp
+
\ No newline at end of file
diff --git a/app/src/main/res/values/drawables.xml b/app/src/main/res/values/drawables.xml
new file mode 100644
index 0000000..3505456
--- /dev/null
+++ b/app/src/main/res/values/drawables.xml
@@ -0,0 +1 @@
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..91e6815
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,12 @@
+
+ Anwesha2k20
+ Navigation header
+
+
+
+ notifications
+ All the notifications are sent through this channel.
+
+ https://celesta.org.in/app/
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..c610918
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..acefd2b
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.1'
+ classpath 'com.google.gms:google-services:4.2.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ maven { url "https://jitpack.io" }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..199d16e
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..cd08cb0
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Aug 28 15:28:41 IST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'