diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0f638d1 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Hillfair2k22 \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index bb1dbfe..15e745e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,27 +3,65 @@ diff --git a/app/build.gradle b/app/build.gradle index f446450..f53ffff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,16 @@ +buildscript { + // ... + dependencies { + // ... + classpath 'com.google.gms:google-services:4.3.2' + } +} plugins { id 'com.android.application' + id 'com.google.gms.google-services' } + android { compileSdk 31 @@ -29,14 +38,43 @@ android { dependencies { + + implementation platform('com.google.firebase:firebase-bom:29.1.0') + implementation 'com.google.firebase:firebase-auth' + + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation "androidx.cardview:cardview:1.0.0" + implementation "androidx.recyclerview:recyclerview:1.2.1" implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'com.google.firebase:firebase-core:20.1.0' + implementation 'com.google.firebase:firebase-auth:21.0.1' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' // volley implementation 'com.android.volley:volley:1.2.1' -} \ No newline at end of file + //glide + implementation 'com.github.bumptech.glide:glide:4.13.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0' + // recycler animators + implementation 'jp.wasabeef:recyclerview-animators:4.0.2' + + //picasso + implementation 'com.squareup.picasso:picasso:2.71828' + // recycler animators + implementation 'jp.wasabeef:recyclerview-animators:4.0.2' + + //fab + implementation 'com.balysv:material-ripple:1.0.2' + + implementation platform('com.google.firebase:firebase-bom:29.1.0') + + implementation 'com.google.firebase:firebase-auth' + +} + +apply plugin: 'com.google.gms.google-services' diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..c7c49e5 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "339348749335", + "project_id": "hillffair22", + "storage_bucket": "hillffair22.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:339348749335:android:26e85df79d6b43806af052", + "android_client_info": { + "package_name": "com.nith.hillfair2k22" + } + }, + "oauth_client": [ + { + "client_id": "339348749335-95clst4snuom47senakou70vpj2s5405.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD9ut9FMht_B9mBD-VFhztElppi7-yqCsE" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "339348749335-95clst4snuom47senakou70vpj2s5405.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5a214f7..da69773 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + + + + + @@ -26,10 +37,10 @@ android:exported="false" /> + android:exported="false" /> + android:exported="true"> @@ -39,8 +50,11 @@ - + + \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/ChatActivity.java b/app/src/main/java/com/nith/hillfair2k22/ChatActivity.java new file mode 100644 index 0000000..9c40413 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/ChatActivity.java @@ -0,0 +1,14 @@ +package com.nith.hillfair2k22; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class ChatActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_chat); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/MainActivity.java b/app/src/main/java/com/nith/hillfair2k22/MainActivity.java index 13998a5..cac1087 100644 --- a/app/src/main/java/com/nith/hillfair2k22/MainActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/MainActivity.java @@ -58,4 +58,6 @@ private void replaceFragment(Fragment fragment){ fragmentTransaction.replace(R.id.fragment_frame_layout,fragment); fragmentTransaction.commit(); } + + } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/LikeList.java b/app/src/main/java/com/nith/hillfair2k22/Models/LikeList.java new file mode 100644 index 0000000..8a4ad5f --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/LikeList.java @@ -0,0 +1,52 @@ +package com.nith.hillfair2k22.Models; + +import java.util.List; + +public class LikeList { + int count; + String next; + String previous; + List result ; + + public LikeList() { + } + + public LikeList(int count, String next, String previous, List result) { + this.count = count; + this.next = next; + this.previous = previous; + this.result = result; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public List getResult() { + return result; + } + + public void setResult(List result) { + this.result = result; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/NewCommentRead.java b/app/src/main/java/com/nith/hillfair2k22/Models/NewCommentRead.java new file mode 100644 index 0000000..4fa7181 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/NewCommentRead.java @@ -0,0 +1,50 @@ +package com.nith.hillfair2k22.Models; + +public class NewCommentRead { + int id; + User_Serializer_For_ImageFeed author; + String text; + String posted_on; + + public NewCommentRead() { + } + + public NewCommentRead(int id, User_Serializer_For_ImageFeed author, String text, String posted_on) { + this.id = id; + this.author = author; + this.text = text; + this.posted_on = posted_on; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public User_Serializer_For_ImageFeed getAuthor() { + return author; + } + + public void setAuthor(User_Serializer_For_ImageFeed author) { + this.author = author; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getPosted_on() { + return posted_on; + } + + public void setPosted_on(String posted_on) { + this.posted_on = posted_on; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/NewMembersList.java b/app/src/main/java/com/nith/hillfair2k22/Models/NewMembersList.java new file mode 100644 index 0000000..1e04c55 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/NewMembersList.java @@ -0,0 +1,58 @@ +package com.nith.hillfair2k22.Models; + +public class NewMembersList { + int id; + String name; + String team_name; + String position; + String image; + + public NewMembersList() { + } + + public NewMembersList(int id, String name,String team_name, String position, String image) { + this.id = id; + this.name = name; + this.team_name = team_name; + this.position = position; + this.image = image; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + public String getTeam_name(){ + return team_name; + } + public void setTeam_name(String team_name){ + this.team_name = team_name; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/NewSponsors.java b/app/src/main/java/com/nith/hillfair2k22/Models/NewSponsors.java new file mode 100644 index 0000000..3da7b02 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/NewSponsors.java @@ -0,0 +1,70 @@ +package com.nith.hillfair2k22.Models; + +public class NewSponsors { + int id; + String name; + String link; + String image; + String position; + int priority; + + public NewSponsors() { + } + + public NewSponsors(int id, String name, String link, String image, String position, int priority) { + this.id = id; + this.name = name; + this.link = link; + this.image = image; + this.position = position; + this.priority = priority; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/NewUserList.java b/app/src/main/java/com/nith/hillfair2k22/Models/NewUserList.java new file mode 100644 index 0000000..e6f64c4 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/NewUserList.java @@ -0,0 +1,80 @@ +package com.nith.hillfair2k22.Models; + +public class NewUserList { + String firebase; + String username; + String phone; + String email; + int score; + String instagramId; + String profileImage; + + public NewUserList() { + } + + public NewUserList(String firebase, String username, String phone, String email, int score, String instagramId, String profileImage) { + this.firebase = firebase; + this.username = username; + this.phone = phone; + this.email = email; + this.score = score; + this.instagramId = instagramId; + this.profileImage = profileImage; + } + + public String getFirebase() { + return firebase; + } + + public void setFirebase(String firebase) { + this.firebase = firebase; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public int getScore() { + return score; + } + + public void setScore(int score) { + this.score = score; + } + + public String getInstagramId() { + return instagramId; + } + + public void setInstagramId(String instagramId) { + this.instagramId = instagramId; + } + + public String getProfileImage() { + return profileImage; + } + + public void setProfileImage(String profileImage) { + this.profileImage = profileImage; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/Posts.java b/app/src/main/java/com/nith/hillfair2k22/Models/Posts.java new file mode 100644 index 0000000..95a6dac --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/Posts.java @@ -0,0 +1,102 @@ +package com.nith.hillfair2k22.Models; + + +public class Posts { + String id; + User_Serializer_For_ImageFeed author; + String photo; + String text; + String location; + String posted_on; + String number_of_likes; + String number_0f_comments; + String post_comments; + + public Posts() { + } + + public Posts(String id, User_Serializer_For_ImageFeed author, String photo, String text, String location, String posted_on, String number_of_likes, String number_0f_comments, String post_comments) { + this.id = id; + this.author = author; + this.photo = photo; + this.text = text; + this.location = location; + this.posted_on = posted_on; + this.number_of_likes = number_of_likes; + this.number_0f_comments = number_0f_comments; + this.post_comments = post_comments; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public User_Serializer_For_ImageFeed getAuthor() { + return author; + } + + public void setAuthor(User_Serializer_For_ImageFeed author) { + this.author = author; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getPosted_on() { + return posted_on; + } + + public void setPosted_on(String posted_on) { + this.posted_on = posted_on; + } + + public String getNumber_of_likes() { + return number_of_likes; + } + + public void setNumber_of_likes(String number_of_likes) { + this.number_of_likes = number_of_likes; + } + + public String getNumber_0f_comments() { + return number_0f_comments; + } + + public void setNumber_0f_comments(String number_0f_comments) { + this.number_0f_comments = number_0f_comments; + } + + public String getPost_comments() { + return post_comments; + } + + public void setPost_comments(String post_comments) { + this.post_comments = post_comments; + } +} + diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/Quiz_List.java b/app/src/main/java/com/nith/hillfair2k22/Models/Quiz_List.java index 6cbcad5..5adf38e 100644 --- a/app/src/main/java/com/nith/hillfair2k22/Models/Quiz_List.java +++ b/app/src/main/java/com/nith/hillfair2k22/Models/Quiz_List.java @@ -3,17 +3,16 @@ public class Quiz_List { String id; String name; - String count; - String sendCount; + String clubName; + int count; + int sendCount; String startTime; String endTime; - public Quiz_List() { - } - - public Quiz_List(String id, String name, String count, String sendCount, String startTime, String endTime) { + public Quiz_List(String id, String name, String clubName, int count, int sendCount, String startTime, String endTime) { this.id = id; this.name = name; + this.clubName = clubName; this.count = count; this.sendCount = sendCount; this.startTime = startTime; @@ -36,19 +35,27 @@ public void setName(String name) { this.name = name; } - public String getCount() { + public String getClubName() { + return clubName; + } + + public void setClubName(String clubName) { + this.clubName = clubName; + } + + public int getCount() { return count; } - public void setCount(String count) { + public void setCount(int count) { this.count = count; } - public String getSendCount() { + public int getSendCount() { return sendCount; } - public void setSendCount(String sendCount) { + public void setSendCount(int sendCount) { this.sendCount = sendCount; } diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/Teams.java b/app/src/main/java/com/nith/hillfair2k22/Models/Teams.java new file mode 100644 index 0000000..3a1941b --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/Teams.java @@ -0,0 +1,37 @@ +package com.nith.hillfair2k22.Models; + +public class Teams { + int id; + String Club_name; + String image; + + public Teams(int id, String club_name, String image) { + this.id = id; + Club_name = club_name; + this.image = image; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getClub_name() { + return Club_name; + } + + public void setClub_name(String club_name) { + Club_name = club_name; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/User_Check_User_Read.java b/app/src/main/java/com/nith/hillfair2k22/Models/User_Check_User_Read.java index 7216196..b2d7da5 100644 --- a/app/src/main/java/com/nith/hillfair2k22/Models/User_Check_User_Read.java +++ b/app/src/main/java/com/nith/hillfair2k22/Models/User_Check_User_Read.java @@ -1,6 +1,20 @@ package com.nith.hillfair2k22.Models; public class User_Check_User_Read { +boolean response; + public User_Check_User_Read() { } + + public User_Check_User_Read(boolean response) { + this.response = response; + } + + public boolean isResponse() { + return response; + } + + public void setResponse(boolean response) { + this.response = response; + } } diff --git a/app/src/main/java/com/nith/hillfair2k22/Models/User_Serializer_For_ImageFeed.java b/app/src/main/java/com/nith/hillfair2k22/Models/User_Serializer_For_ImageFeed.java new file mode 100644 index 0000000..744df01 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/Models/User_Serializer_For_ImageFeed.java @@ -0,0 +1,20 @@ +package com.nith.hillfair2k22.Models; + +public class User_Serializer_For_ImageFeed { + String username; + + public User_Serializer_For_ImageFeed() { + } + + public User_Serializer_For_ImageFeed(String username) { + this.username = username; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/CustomAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/CustomAdapter.java new file mode 100644 index 0000000..6559aa4 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/CustomAdapter.java @@ -0,0 +1,96 @@ +package com.nith.hillfair2k22.adapters; + + + + +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.ToggleButton; + +import androidx.recyclerview.widget.RecyclerView; + +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.home.CommentUserFeedFragment; +import com.nith.hillfair2k22.screens.home.Contact; + +public class CustomAdapter extends RecyclerView.Adapter { + + private Contact[] localDataSet; + private TextView user_feed_name; + private TextView user_feed_caption_goes_here; + private ImageView imageview2; + private ToggleButton toggleButton; + /** + * Provide a reference to the type of views that you are using + * (custom ViewHolder). + */ + public static class ViewHolder extends RecyclerView.ViewHolder { + private final TextView textView; + + public ViewHolder(View view) { + super(view); + // Define click listener for the ViewHolder's View + + textView = (TextView) view.findViewById(R.id.textView); + } + + public TextView getTextView() { + return textView; + } + } + + /** + * Initialize the dataset of the Adapter. + * + * @param dataSet String[] containing the data to populate views to be used + * by RecyclerView. + */ + public CustomAdapter(Contact[] dataSet) { + localDataSet = dataSet; + } + + // Create new views (invoked by the layout manager) + @Override + public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { + // Create a new view, which defines the UI of the list item + View view = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.item_user_feed, viewGroup, false); + user_feed_name=view.findViewById(R.id.user_feed_name); + user_feed_caption_goes_here=view.findViewById(R.id.user_feed_caption_goes_here); + toggleButton=view.findViewById(R.id.like_button); + + imageview2=view.findViewById(R.id.user_feed_message_icon); + imageview2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(view.getContext(), CommentUserFeedFragment.class); + intent.putExtra("post_like",toggleButton.isChecked()); + view.getContext().startActivity(intent); + } + }); + return new ViewHolder(view); + } + + // Replace the contents of a view (invoked by the layout manager) + @Override + public void onBindViewHolder(ViewHolder viewHolder, final int position) { + + + + // Get element from your dataset at this position and replace the + // contents of the view with that element + user_feed_name.setText(localDataSet[position].name); + user_feed_caption_goes_here.setText(localDataSet[position].caption); + } + + // Return the size of your dataset (invoked by the layout manager) + @Override + public int getItemCount() { + return localDataSet.length; + } +} + diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/EventAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/EventAdapter.java new file mode 100644 index 0000000..3fbcfb4 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/EventAdapter.java @@ -0,0 +1,96 @@ +package com.nith.hillfair2k22.adapters; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.RecyclerView; + +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.eventsAndWorkshops.EventAndWorkshopDetailsFragment; + +import java.util.ArrayList; +import java.util.List; + +public class EventAdapter extends RecyclerView.Adapter { + + private List eventsModalArrayList; + private Context context; + + public EventAdapter(List eventsModalArrayList, Context context) { + this.eventsModalArrayList = eventsModalArrayList; + this.context = context; + } + + @NonNull + @Override + public EventViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_all_events_workshops, parent, false); + return new EventViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull EventViewHolder holder, int position) { + + Events events = eventsModalArrayList.get(position); +// if(events.getType()==1){ + holder.eventTitle.setText(events.getTitle()); + holder.clubName.setText(events.getClubName()); + holder.dateTime.setText(events.getStartTime()); +// } + + + holder.item_CV.setOnClickListener(view -> { + + changeFragment(new EventAndWorkshopDetailsFragment(), view, events); + + + }); + } + + // Fragment Change + private void changeFragment(Fragment fragment, View view, Events events) { + + + AppCompatActivity activity = (AppCompatActivity) view.getContext(); + //TODO: change replace id to --"fragment_frame_layout"-- + activity.getSupportFragmentManager().beginTransaction().replace(R.id.all_events_workshop_RL, fragment).addToBackStack(null).commit(); + + Bundle bundle = new Bundle(); + bundle.putString("Title", events.getTitle()); + bundle.putString("ImageUrl", events.getImage()); + bundle.putString("description", events.getDescription()); + bundle.putString("regUrl", events.getRegUrl()); + fragment.setArguments(bundle); + } + + @Override + public int getItemCount() { + return eventsModalArrayList.size(); + } + + public class EventViewHolder extends RecyclerView.ViewHolder { + + //create variable for views + private TextView eventTitle, clubName, dateTime; + private CardView item_CV; + + public EventViewHolder(@NonNull View itemView) { + super(itemView); + +// initialize views with ids. + eventTitle = itemView.findViewById(R.id.Event_name); + clubName = itemView.findViewById(R.id.Club_name); + dateTime = itemView.findViewById(R.id.date_time); + item_CV = itemView.findViewById(R.id.events_RV_item_CV); + } + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/EventsFragmentAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/EventsFragmentAdapter.java new file mode 100644 index 0000000..0363a58 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/EventsFragmentAdapter.java @@ -0,0 +1,31 @@ +package com.nith.hillfair2k22.adapters; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.lifecycle.Lifecycle; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +import com.nith.hillfair2k22.screens.eventsAndWorkshops.EventsFragment; +import com.nith.hillfair2k22.screens.eventsAndWorkshops.WorkshopFragment; + +public class EventsFragmentAdapter extends FragmentStateAdapter{ + + public EventsFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) { + super(fragmentManager, lifecycle); + } + + @NonNull + @Override + public Fragment createFragment(int position) { + if (position == 1){ + return new WorkshopFragment(); + } + return new EventsFragment(); + } + + @Override + public int getItemCount() { + return 2; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/LeaderboardAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/LeaderboardAdapter.java new file mode 100644 index 0000000..9623ac2 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/LeaderboardAdapter.java @@ -0,0 +1,63 @@ +package com.nith.hillfair2k22.adapters; + +import android.content.Context; +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.nith.hillfair2k22.Models.Quiz_Leaderboard_Results_Read; +import com.nith.hillfair2k22.R; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +public class LeaderboardAdapter extends RecyclerView.Adapter { + + private ArrayList LBArrayList ; + private Context context; + + public LeaderboardAdapter(ArrayList LBArrayList, Context context) { + this.LBArrayList = LBArrayList; + this.context = context; + } + + @NonNull + @Override + public LBViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_leader_board, parent, false); + return new LBViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull LBViewHolder holder, int position) { + + Quiz_Leaderboard_Results_Read LB_result_card = LBArrayList.get(position); + holder.LBname.setText(LB_result_card.getUsername()); + holder.LBscore.setText(String.valueOf(LB_result_card.getScore())); + + Picasso.get().load(LB_result_card.getProfileImage()).into(holder.LBimg); + } + + @Override + public int getItemCount() { + return LBArrayList.size(); + } + + public class LBViewHolder extends RecyclerView.ViewHolder { + + private TextView LBname, LBscore; + private ImageView LBimg; + public LBViewHolder(@NonNull View itemView) { + super(itemView); + + LBname =itemView.findViewById(R.id.LB_username); + LBscore =itemView.findViewById(R.id.LB_score); + LBimg = itemView.findViewById(R.id.quiz_profile_IV); + } + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/NewCustomAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/NewCustomAdapter.java new file mode 100644 index 0000000..947df9f --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/NewCustomAdapter.java @@ -0,0 +1,100 @@ +package com.nith.hillfair2k22.adapters; + + + + +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.home.CommentUserFeedFragment; +import com.nith.hillfair2k22.screens.home.Contact; +import com.nith.hillfair2k22.screens.home.UserComments; + +public class NewCustomAdapter extends RecyclerView.Adapter { + + private UserComments[] localDataSet; +// private TextView user_feed_name; +// private TextView user_feed_caption_goes_here; +// private ImageView imageview2; + private TextView username; + private TextView comments; + /** + * Provide a reference to the type of views that you are using + * (custom ViewHolder). + */ + public static class ViewHolder extends RecyclerView.ViewHolder { + private final TextView textView; + + public ViewHolder(View view) { + super(view); + // Define click listener for the ViewHolder's View + + textView = (TextView) view.findViewById(R.id.textView); + } + + public TextView getTextView() { + return textView; + } + } + + /** + * Initialize the dataset of the Adapter. + * + * @param dataSet String[] containing the data to populate views to be used + * by RecyclerView. + */ + public NewCustomAdapter(UserComments[] dataSet) { + localDataSet = dataSet; + } + + // Create new views (invoked by the layout manager) + @Override + public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { + // Create a new view, which defines the UI of the list item + View view = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.item_comment_user_feed, viewGroup, false); +// user_feed_name=view.findViewById(R.id.user_feed_name); +// user_feed_caption_goes_here=view.findViewById(R.id.user_feed_caption_goes_here); +// imageview2=view.findViewById(R.id.user_feed_message_icon); +// imageview2.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// Intent intent=new Intent(view.getContext(), CommentUserFeedFragment.class); +// view.getContext().startActivity(intent); +// } +// }); + username=view.findViewById(R.id.user_comment_user_name_in_comment); + comments=view.findViewById(R.id.user_comment_comment_in_comment_section); + + + return new ViewHolder(view); + } + + // Replace the contents of a view (invoked by the layout manager) + @Override + public void onBindViewHolder(ViewHolder viewHolder, final int position) { + + + + // Get element from your dataset at this position and replace the + // contents of the view with that element +// user_feed_name.setText(localDataSet[position].name); +// user_feed_caption_goes_here.setText(localDataSet[position].caption); + username.setText(localDataSet[position].username); + comments.setText(localDataSet[position].comments); + } + + // Return the size of your dataset (invoked by the layout manager) + @Override + public int getItemCount() { + return localDataSet.length; + } +} + diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/QuizAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/QuizAdapter.java new file mode 100644 index 0000000..4349cab --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/QuizAdapter.java @@ -0,0 +1,68 @@ +package com.nith.hillfair2k22.adapters; + +import android.content.Context; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + +import com.nith.hillfair2k22.Models.Quiz_List; +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.NewQuizActivity; +import com.nith.hillfair2k22.screens.PlayQuizActivity; + +import java.util.ArrayList; + +public class QuizAdapter extends RecyclerView.Adapter { + + private ArrayList quizListArrayList ; + private Context context; + + public QuizAdapter(ArrayList quizListArrayList, Context context) { + this.quizListArrayList = quizListArrayList; + this.context = context; + } + + @NonNull + @Override + public QuizViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_quiz_item, parent, false); + return new QuizViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull QuizViewHolder holder, int position) { + Quiz_List quiz = quizListArrayList.get(position); + holder.quizNo.setText("Quiz "+(position+1)); + holder.quizClub.setText(quiz.getName()); + holder.quizDate.setText(quiz.getStartTime()); + holder.quizItem.setOnClickListener(view -> { + context.startActivity(new Intent(context, NewQuizActivity.class)); + }); + } + + @Override + public int getItemCount() { + return quizListArrayList.size(); + } + + public class QuizViewHolder extends RecyclerView.ViewHolder { + + private TextView quizNo, quizClub, quizDate; + private CardView quizItem; + public QuizViewHolder(@NonNull View itemView) { + super(itemView); + + quizNo=itemView.findViewById(R.id.quiz_name); + quizClub=itemView.findViewById(R.id.Club_quiz_name); + quizDate=itemView.findViewById(R.id.quiz_date_time); + quizItem=itemView.findViewById(R.id.quiz_item); + } + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/SponsorsAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/SponsorsAdapter.java new file mode 100644 index 0000000..151eea7 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/SponsorsAdapter.java @@ -0,0 +1,85 @@ +package com.nith.hillfair2k22.adapters; + + +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +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.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + +import com.nith.hillfair2k22.Models.NewSponsors; +import com.nith.hillfair2k22.Models.Sponsor; +import com.nith.hillfair2k22.R; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.List; + + +public class SponsorsAdapter extends RecyclerView.Adapter { + + private List sponsorsModalArrayList; + private Context context; + + public SponsorsAdapter(List sponsorsModalArrayList, Context context) { + this.sponsorsModalArrayList = sponsorsModalArrayList; + this.context = context; + } + + @NonNull + @Override + public SponsorsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_sponsors, parent, false); + return new SponsorsViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull SponsorsViewHolder holder, int position) { + + NewSponsors sponsor = sponsorsModalArrayList.get(position); + holder.sponsorDetatils.setText(sponsor.getName()); + String imgUrl = sponsor.getImage(); + + if (imgUrl.isEmpty()){ +// Picasso.get().load(imgUrl.replace("http", "https")).into(holder.sponsorImage); + }else { + Picasso.get().load(imgUrl.replace("http", "https")).into(holder.sponsorImage); + } + + if(!sponsor.getLink().isEmpty()){ + Uri sponsorsUri = Uri.parse(sponsor.getLink()); + holder.sponsorsCV.setOnClickListener(view -> { + context. startActivity(new Intent(Intent.ACTION_VIEW, sponsorsUri)); + }); + } + + + } + + @Override + public int getItemCount() { + return sponsorsModalArrayList.size(); + } + + public class SponsorsViewHolder extends RecyclerView.ViewHolder{ + + private ImageView sponsorImage; + private TextView sponsorDetatils; + private CardView sponsorsCV; + public SponsorsViewHolder(@NonNull View itemView) { + super(itemView); + + sponsorImage =itemView.findViewById(R.id.sponsors_IV); + sponsorDetatils =itemView.findViewById(R.id.sponsors_detailsTV); + sponsorsCV=itemView.findViewById(R.id.item_sponsor_card); + } + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/TeamAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/TeamAdapter.java index 6457d4d..9c95013 100644 --- a/app/src/main/java/com/nith/hillfair2k22/adapters/TeamAdapter.java +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/TeamAdapter.java @@ -11,6 +11,10 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.BaseRequestOptions; +import com.bumptech.glide.request.RequestOptions; +import com.nith.hillfair2k22.Models.Teams; import com.nith.hillfair2k22.R; import com.nith.hillfair2k22.screens.teams.Team; import com.nith.hillfair2k22.screens.teams.TeamsFragment; @@ -20,14 +24,19 @@ public class TeamAdapter extends RecyclerView.Adapter { private OnItemClickListener mListener; private final Context context; - private List teamList; + private List teamList; + RequestOptions options; - public TeamAdapter(List teamList, Context context) { + + public TeamAdapter(List teamList, Context context) { this.teamList = teamList; this.context = context; + //request option for glide + options= new RequestOptions().centerCrop().placeholder(R.drawable.loading_image).error(R.drawable.loading_image); } + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(context).inflate(R.layout.item_team, parent, false); return new MyViewHolder(itemView); @@ -35,10 +44,12 @@ public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { - Team team = teamList.get(position); + Teams team = teamList.get(position); - holder.teamNameTextView.setText(team.getTeam_Name()); - holder.teamImageImageView.setImageURI(Uri.parse(team.getTeamImage())); + holder.teamNameTextView.setText(team.getClub_name()); + holder.teamImageImageView.setImageURI(Uri.parse(team.getImage())); + //loading image using glide + Glide.with(context).load(team.getImage().replace("http","https")).apply(options).into(holder.teamImageImageView); } @Override diff --git a/app/src/main/java/com/nith/hillfair2k22/adapters/TeamDetailAdapter.java b/app/src/main/java/com/nith/hillfair2k22/adapters/TeamDetailAdapter.java index beae4b6..fa12351 100644 --- a/app/src/main/java/com/nith/hillfair2k22/adapters/TeamDetailAdapter.java +++ b/app/src/main/java/com/nith/hillfair2k22/adapters/TeamDetailAdapter.java @@ -9,8 +9,13 @@ import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.lifecycle.Observer; import androidx.recyclerview.widget.RecyclerView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; +import com.nith.hillfair2k22.Models.Members_List; +import com.nith.hillfair2k22.Models.NewMembersList; import com.nith.hillfair2k22.R; import com.nith.hillfair2k22.screens.teams.TeamDetail; @@ -18,11 +23,13 @@ public class TeamDetailAdapter extends RecyclerView.Adapter{ private final Context context; - private final List teamDetailList; + private final List teamDetailList; + RequestOptions option; - public TeamDetailAdapter(List teamDetailList, Context context) { + public TeamDetailAdapter(List teamDetailList, Context context) { this.context = context; this.teamDetailList=teamDetailList; + option= new RequestOptions().centerCrop().placeholder(R.drawable.loading_image).error(R.drawable.loading_image); } @NonNull @@ -34,11 +41,12 @@ public TeamDetailAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup pare @Override public void onBindViewHolder(@NonNull MyViewHolder detailholder, int position) { - TeamDetail teamDetail = teamDetailList.get(position); - detailholder.teamNameTextView.setText(teamDetail.getTeam_Name1()); - detailholder.teamMemImageView.setImageURI(Uri.parse(teamDetail.getTeam_mem_Img())); - detailholder.teamMemName.setText(teamDetail.getTeam_Member_Name()); - detailholder.memDesignation.setText(teamDetail.getDesignation()); + NewMembersList teamDetail = teamDetailList.get(position); +// detailholder.teamNameTextView.setText(teamDetail.getTeam_name()); + detailholder.teamMemImageView.setImageURI(Uri.parse(teamDetail.getImage())); + detailholder.teamMemName.setText(teamDetail.getName()); + detailholder.memDesignation.setText(teamDetail.getPosition()); + Glide.with(context).load(teamDetail.getImage().replace("http","https")).apply(option).into(detailholder.teamMemImageView); } @@ -48,6 +56,7 @@ public int getItemCount() { } public static class MyViewHolder extends RecyclerView.ViewHolder { + int id; TextView teamNameTextView; ImageView teamMemImageView; TextView teamMemName; @@ -56,6 +65,7 @@ public static class MyViewHolder extends RecyclerView.ViewHolder { public MyViewHolder(View detailview) { super(detailview); + id=detailview.getId(); teamNameTextView = (TextView) detailview.findViewById(R.id.team_name1); teamMemImageView = (ImageView) detailview.findViewById(R.id.team_mem_img); teamMemName=(TextView) detailview.findViewById(R.id.team_member_name); diff --git a/app/src/main/java/com/nith/hillfair2k22/apis/EventsVolleyHelper.java b/app/src/main/java/com/nith/hillfair2k22/apis/EventsVolleyHelper.java new file mode 100644 index 0000000..00470d3 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/apis/EventsVolleyHelper.java @@ -0,0 +1,92 @@ +package com.nith.hillfair2k22.apis; + +import android.content.Context; +import android.util.Log; + +import androidx.lifecycle.MutableLiveData; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.JsonArrayRequest; +import com.android.volley.toolbox.JsonObjectRequest; +import com.android.volley.toolbox.Volley; +import com.nith.hillfair2k22.Models.Events; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class EventsVolleyHelper { + Context context; + RequestQueue requestQueue; + public EventsVolleyHelper(Context context){ + this.context = context; + requestQueue = Volley.newRequestQueue(context); + } + + // ModelsUsed -> Events; + + public static MutableLiveData> eventList; + public void getEvents() { + eventList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/events/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List a3 = new ArrayList<>(); + for (int i = 0; i < response.length(); i++) { + try { + Log.e("EventsR", String.valueOf(response)); + JSONObject jsonObject = response.getJSONObject(i); + a3.add(new Events(jsonObject.getString("title"), jsonObject.getString("description"), jsonObject.getString("startTime"), jsonObject.getString("endTime"), jsonObject.getString("clubName"), jsonObject.getString("platform"), jsonObject.getString("image"), jsonObject.getString("regURL"), jsonObject.getInt("type"))); + } catch (JSONException e) { + Log.e("EventError", String.valueOf(e.getMessage())); + e.printStackTrace(); + } + } + eventList.postValue(a3); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + } + ); + requestQueue.add(jsonArrayRequest); + } + + public static MutableLiveData EventRead; + public void getEvents_Read(String title) { + EventRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "http://anmolcoder.pythonanywhere.com/events/"+title, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("EventsRead", String.valueOf(response)); + Events evdetails = new Events(response.getString("title"), response.getString("description"), response.getString("startTime"), response.getString("endTime"), response.getString("clubName"), response.getString("platform"), response.getString("image"), response.getString("regURL"), response.getInt("type")); + EventRead.postValue(evdetails); + + + } catch (JSONException e) { + Log.e("EventReadError", String.valueOf(e.getMessage())); + e.printStackTrace(); + } + + + + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + }); + requestQueue.add(jsonObjectRequest); + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/apis/MemberVolleyHelper.java b/app/src/main/java/com/nith/hillfair2k22/apis/MemberVolleyHelper.java new file mode 100644 index 0000000..b5df5ac --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/apis/MemberVolleyHelper.java @@ -0,0 +1,191 @@ +package com.nith.hillfair2k22.apis; + +import android.content.Context; +import android.util.Log; + +import androidx.lifecycle.MutableLiveData; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.JsonArrayRequest; +import com.android.volley.toolbox.JsonObjectRequest; +import com.android.volley.toolbox.Volley; +import com.nith.hillfair2k22.Models.NewMembersList; +import com.nith.hillfair2k22.Models.NewUserList; +import com.nith.hillfair2k22.Models.Teams; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.nio.channels.MulticastChannel; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.locks.ReadWriteLock; + +public class MemberVolleyHelper { + Context context; + RequestQueue requestQueue; + public MemberVolleyHelper(Context context){ + this.context = context; + requestQueue = Volley.newRequestQueue(context); + + } + // ModelsUsed-> NewMembersList; + public static MutableLiveData> memberList; + public void getMembers(){ + memberList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/teams/member/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List Mlist = new ArrayList<>(); + for (int i=0;i memberRead; + public void readMember(int id){ + memberRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/teams/member/"+id, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("ReadMember",String.valueOf(response)); + int id = response.getInt("id"); + String name = response.getString("name"); + String team_name = response.getString("team_name"); + String position = response.getString("position"); + String image = response.getString("image"); + NewMembersList member = new NewMembersList(id,name,team_name,position,image); + memberRead.postValue(member); + } catch (JSONException e) { + Log.e("eReadMember",e.getMessage()); + e.printStackTrace(); + } + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("errorReadMember",error.getMessage()); + } + }); + requestQueue.add(jsonObjectRequest); + } + public static MutableLiveData> teamList; + public void getTeamList(){ + teamList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/teams/team/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List Team = new ArrayList<>(); + Log.e("TeamRsp",String.valueOf(response)); + for(int i = 0;i teamRead; + public void getTeamRead(int id){ + teamRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/teams/team/"+id, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("REadteam",String.valueOf(response)); + int id = response.getInt("id"); + String club_name = response.getString("club_name"); + String image = response.getString("image"); + + Teams T1 = new Teams(id,club_name,image); + teamRead.postValue(T1); + } catch (JSONException e) { + Log.e("exRead",e.getMessage()); + e.printStackTrace(); + } + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("errorREadteam",String.valueOf(error)); + } + }); + requestQueue.add(jsonObjectRequest); + } + public static MutableLiveData> teamMemberList ; +public void getTeamMember(String teamname){ + teamMemberList = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest =new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/teams/"+teamname, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + JSONArray jsonArray = response.getJSONArray(teamname+"Members"); + List Mmlist = new ArrayList<>(); + for(int i=0;i NewUserList; + // MainActivity code for GetMethod; + // final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + // @Override + // public void onChanged(List newUserLists) { + // Log.e("abcd43",String.valueOf(newUserLists)); + // for(int i=0;i> newUserArrayList; + public void getUser(){ + newUserArrayList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/user/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List newlist = new ArrayList<>(); + for(int i=0;i userRead; + public void readUser(String firebase){ + userRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, + "https://anmolcoder.pythonanywhere.com/user/"+firebase+"/", + null, + new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("UserRead",String.valueOf(response)); + String firebase = response.getString("firebase"); + String username = response.getString("username"); + String phone = response.getString("phone"); + String email = response.getString("email"); + int score = response.getInt("score"); + String instagramId = response.getString("instagramId"); + String profileImage = response.getString("profileImage"); + NewUserList item = new NewUserList(firebase,username,phone,email,score,instagramId,profileImage); + userRead.postValue(item); + } catch (JSONException e) { + Log.e("userexception",e.getMessage()); + e.printStackTrace(); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + + } + }); + requestQueue.add(jsonObjectRequest); + } + + public static MutableLiveData Check; + public void checkUser(String email){ + + Check = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/user/checkUser/"+email, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("ChekUser",String.valueOf(response)); + try { + boolean res =response.getBoolean("user_present"); + Log.e("abcd",String.valueOf(res)); + User_Check_User_Read U1 = new User_Check_User_Read(res); + + Check.postValue(U1); + } catch (JSONException e) { + e.printStackTrace(); + } + + + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + }); + + + requestQueue.add(jsonObjectRequest); + + } + + public void postUser(NewUserList alist){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("firebase",alist.getFirebase()); + jsonbody.put("username",alist.getUsername()); + jsonbody.put("phone",alist.getPhone()); + jsonbody.put("email",alist.getEmail()); + jsonbody.put("score",alist.getScore()); + jsonbody.put("instagramId",alist.getInstagramId()); + jsonbody.put("profileImage",alist.getProfileImage()); + } catch (JSONException e) { + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, "https://anmolcoder.pythonanywhere.com/user/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("PostUser",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + NetworkResponse response = error.networkResponse; + if (response != null) { + if (response.statusCode == 400 || response.statusCode == 404 || response.statusCode == 422 || response.statusCode == 401) { + try { + JSONObject object = new JSONObject(new String(response.data)); + if (object.getJSONObject("Errors:").has("username")) { + String usernameErr = object.getJSONObject("Errors:").getJSONArray("username").get(0).toString(); + Log.e("jsonObject", usernameErr); + Toast.makeText(context, usernameErr, Toast.LENGTH_SHORT).show(); + + } + if (object.getJSONObject("Errors:").has("email")) { + String emailErr = object.getJSONObject("Errors:").getJSONArray("email").get(0).toString(); + Log.e("jsonObject", emailErr); + Toast.makeText(context, emailErr, Toast.LENGTH_SHORT).show(); + + } else { + String ResultMsg = object.getString("Message"); + Log.e("jsonObject", ResultMsg); + Toast.makeText(context, ResultMsg, Toast.LENGTH_SHORT).show(); + + } + + } catch (JSONException e) { + e.printStackTrace(); + Log.e("jsonerror", e.getMessage()); + + } + } else { + Log.e("jsonObject", "Error with response code " + response.data); + Toast.makeText(context, "Error with response code " + response.statusCode, Toast.LENGTH_SHORT).show(); + + } + } else { + + String message = null; + if (error instanceof NetworkError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ServerError) { + message = "The server could not be found. Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof AuthFailureError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ParseError) { + message = "Parsing error! Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof TimeoutError) { + message = "Connection TimeOut! Please check your internet connection."; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } + } + + + } + }); + requestQueue.add(jsonObjectRequest); + + } + + public void updateUser (String firebase,NewUserList alist){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("firebase",alist.getFirebase()); + jsonbody.put("username",alist.getUsername()); + jsonbody.put("phone",alist.getPhone()); + jsonbody.put("email",alist.getEmail()); + jsonbody.put("score",alist.getScore()); + jsonbody.put("instagramId",alist.getInstagramId()); + jsonbody.put("profileImage",alist.getProfileImage()); + } catch (JSONException e) { + Log.e("NewError",e.getMessage()); + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, "https://anmolcoder.pythonanywhere.com/user/"+ firebase+"/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("updateUser",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + NetworkResponse response = error.networkResponse; + if (response != null) { + if (response.statusCode == 400 || response.statusCode == 404 || response.statusCode == 422 || response.statusCode == 401) { + try { + JSONObject object = new JSONObject(new String(response.data)); + if (object.getJSONObject("Errors:").has("username")) { + String usernameErr = object.getJSONObject("Errors:").getJSONArray("username").get(0).toString(); + Log.e("jsonObject", usernameErr); + Toast.makeText(context, usernameErr, Toast.LENGTH_SHORT).show(); + + } + if (object.getJSONObject("Errors:").has("email")) { + String emailErr = object.getJSONObject("Errors:").getJSONArray("email").get(0).toString(); + Log.e("jsonObject", emailErr); + Toast.makeText(context, emailErr, Toast.LENGTH_SHORT).show(); + + } else { + String ResultMsg = object.getString("Message"); + Log.e("jsonObject", ResultMsg); + Toast.makeText(context, ResultMsg, Toast.LENGTH_SHORT).show(); + + } + + } catch (JSONException e) { + e.printStackTrace(); + Log.e("jsonerror", e.getMessage()); + + } + } else { + Log.e("jsonObject", "Error with response code " + response.data); + Toast.makeText(context, "Error with response code " + response.statusCode, Toast.LENGTH_SHORT).show(); + + } + } else { + + String message = null; + if (error instanceof NetworkError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ServerError) { + message = "The server could not be found. Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof AuthFailureError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ParseError) { + message = "Parsing error! Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof TimeoutError) { + message = "Connection TimeOut! Please check your internet connection."; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } + } + + } + }); + requestQueue.add(jsonObjectRequest); + + } + public void partialUserUpdate(String firebase,NewUserList alist){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("firebase",alist.getFirebase()); + jsonbody.put("username",alist.getUsername()); + jsonbody.put("phone",alist.getPhone()); + jsonbody.put("email",alist.getEmail()); + jsonbody.put("score",alist.getScore()); + jsonbody.put("instagramId",alist.getInstagramId()); + jsonbody.put("profileImage",alist.getProfileImage()); + } catch (JSONException e) { + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PATCH, "https://anmolcoder.pythonanywhere.com/user/"+firebase+"/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("PartialUserUpdate",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + NetworkResponse response = error.networkResponse; + if (response != null) { + if (response.statusCode == 400 || response.statusCode == 404 || response.statusCode == 422 || response.statusCode == 401) { + try { + JSONObject object = new JSONObject(new String(response.data)); + if (object.getJSONObject("Errors:").has("username")) { + String usernameErr = object.getJSONObject("Errors:").getJSONArray("username").get(0).toString(); + Log.e("jsonObject", usernameErr); + Toast.makeText(context, usernameErr, Toast.LENGTH_SHORT).show(); + + } + if (object.getJSONObject("Errors:").has("email")) { + String emailErr = object.getJSONObject("Errors:").getJSONArray("email").get(0).toString(); + Log.e("jsonObject", emailErr); + Toast.makeText(context, emailErr, Toast.LENGTH_SHORT).show(); + + } else { + String ResultMsg = object.getString("Message"); + Log.e("jsonObject", ResultMsg); + Toast.makeText(context, ResultMsg, Toast.LENGTH_SHORT).show(); + + } + + } catch (JSONException e) { + e.printStackTrace(); + Log.e("jsonerror", e.getMessage()); + + } + } else { + Log.e("jsonObject", "Error with response code " + response.data); + Toast.makeText(context, "Error with response code " + response.statusCode, Toast.LENGTH_SHORT).show(); + + } + } else { + + String message = null; + if (error instanceof NetworkError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ServerError) { + message = "The server could not be found. Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof AuthFailureError) { + message = "Cannot connect to Internet...Please check your connection!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof ParseError) { + message = "Parsing error! Please try again after some time!!"; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } else if (error instanceof TimeoutError) { + message = "Connection TimeOut! Please check your internet connection."; + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + Log.e("error", message); + } + } + + + } + }); + requestQueue.add(jsonObjectRequest); + + } + public void deleteUser(String firebase) { +// JSONObject jsonbody = new JSONObject(); +// try { +// jsonbody.put("firebase",firebase); +// Log.e("messae","deleted"); +// } catch (JSONException e) { +// e.printStackTrace(); +// } + + + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, "https://anmolcoder.pythonanywhere.com/user/" + firebase+"/", null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("DeleteUser", "Datadeleted"); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + }); + requestQueue.add(jsonObjectRequest); + + } + + +} diff --git a/app/src/main/java/com/nith/hillfair2k22/apis/PostVolleyHelper.java b/app/src/main/java/com/nith/hillfair2k22/apis/PostVolleyHelper.java new file mode 100644 index 0000000..7e14644 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/apis/PostVolleyHelper.java @@ -0,0 +1,308 @@ +package com.nith.hillfair2k22.apis; + +import android.content.Context; +import android.util.Log; + +import androidx.lifecycle.MutableLiveData; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.JsonArrayRequest; +import com.android.volley.toolbox.JsonObjectRequest; +import com.android.volley.toolbox.Volley; +import com.nith.hillfair2k22.MainActivity; +import com.nith.hillfair2k22.Models.LikeList; +import com.nith.hillfair2k22.Models.NewCommentRead; +import com.nith.hillfair2k22.Models.Posts; +import com.nith.hillfair2k22.Models.User_Serializer_For_ImageFeed; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class PostVolleyHelper { + Context context; + RequestQueue requestQueue; + public PostVolleyHelper(Context context){ + this.context = context; + requestQueue = Volley.newRequestQueue(context); + } + +// MainActivityCode; +// PostVolleyHelper p1 = new PostVolleyHelper(MainActivity.this); +//p1.getLikeCountList("7a1d6d27-8306-4ebd-b74d-8ca2a68e1149"); +// final androidx.lifecycle.Observer observer4 = new androidx.lifecycle.Observer() { +// @Override +// public void onChanged(LikeList likeList) { +// Log.e("abcdef",String.valueOf(likeList)); +// Log.e("idf123",String.valueOf(likeList.getCount())); +// Log.e("iddfgd12345",String.valueOf(likeList.getNext())); +// Log.e("idgsd23",String.valueOf(likeList.getPrevious())); +// Log.e("eddf",String.valueOf(likeList.getResult().get(0).getUsername())); +// } +// }; +// likeList.observe(this,observer4); + + // MODELS USED -> Posts,NewCommentRead,User_Serializer_For_ImageFeed,LikeList; + + + + + + + + public static MutableLiveData> PostArrayList; + public void getPost(){ + PostArrayList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/imagefeed/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List plist = new ArrayList<>(); + for(int i=0;i() { + @Override + public void onResponse(JSONObject response) { + Log.e("Resoi",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + }); + requestQueue.add(jsonObjectRequest); + + } + public static MutableLiveData commentRead; + public void getCommentRead(String comment_id){ + commentRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/imagefeed/comment/"+comment_id+"/", null, new Response.Listener() { + + @Override + public void onResponse(JSONObject response) { + try { + Log.e("CommentRead",String.valueOf(response)); + int id = response.getInt("id"); + JSONObject userSerializer = response.getJSONObject("author"); + String Username = userSerializer.getString("username"); + User_Serializer_For_ImageFeed author = new User_Serializer_For_ImageFeed(Username); + String text = response.getString("text"); + String posted_on = response.getString("posted_on"); + NewCommentRead item = new NewCommentRead(id,author,text,posted_on); + commentRead.postValue(item); + + } catch (JSONException e) { + Log.e("CommentExcept",e.getMessage()); + e.printStackTrace(); + } + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("CommentREadError",error.getMessage()); + } + }); + requestQueue.add(jsonObjectRequest); + } + public void CommentPost(String firebase ,String post_id,String text){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("text",text); + } catch (JSONException e) { + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, "https://anmolcoder.pythonanywhere.com/imagefeed/comment/"+post_id+"/"+firebase+"/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("CreateComment",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("CommenteRror",error.getMessage()); + } + }); + requestQueue.add(jsonObjectRequest); + + + } + + public void UpdateComment(String comment_id ,String text){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("text",text); + } catch (JSONException e) { + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, "https://anmolcoder.pythonanywhere.com/imagefeed/comment/"+comment_id+"/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("UpdateComment",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("UpdateCommenteRror",error.getMessage()); + } + }); + requestQueue.add(jsonObjectRequest); + + + } + + public void partialCommentUpdate(String comment_id ,String text){ + JSONObject jsonbody = new JSONObject(); + try { + jsonbody.put("text",text); + } catch (JSONException e) { + e.printStackTrace(); + } + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, "https://anmolcoder.pythonanywhere.com/imagefeed/comment/"+comment_id+"/", jsonbody, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("Updatepartial",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("partialCommenteRror",error.getMessage()); + } + }); + requestQueue.add(jsonObjectRequest); + + + } + + + public void deleteComment(String comment_id){ + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, "https://anmolcoder.pythonanywhere.com/imagefeed/comment/"+comment_id+"/", null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("Del","Deleted"); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + + } + }); + requestQueue.add(jsonObjectRequest); + + } + public void likeRead(String firebase,String post_id){ + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/imagefeed/like/"+post_id+"/"+firebase, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + Log.e("LikeRead",String.valueOf(response)); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("ErrorLike",error.getMessage()); + + } + }); + requestQueue.add(jsonObjectRequest); + } + + public static MutableLiveData likeList; + public void getLikeCountList(String post_id){ + likeList = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "http://anmolcoder.pythonanywhere.com/imagefeed/"+post_id+"/get-likers/", null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("likelist",String.valueOf(response)); + int count = response.getInt("count"); + String next = response.getString("next"); + String previous = response.getString("previous"); + JSONArray resultarray = new JSONArray(); + resultarray = response.getJSONArray("results"); + List results = new ArrayList<>(); + for(int i=0;i NewSponsors; + public static MutableLiveData> sponsorList; + public void getSponsors(){ + sponsorList = new MutableLiveData<>(); + JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, "https://anmolcoder.pythonanywhere.com/sponsors/", null, new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + List slist = new ArrayList<>(); + for(int i=0;i sponsorsRead; + public void readSponsors(int id){ + sponsorsRead = new MutableLiveData<>(); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, "http://anmolcoder.pythonanywhere.com/sponsors/"+ id, null, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + try { + Log.e("Readresponse",String.valueOf(response)); + int id = response.getInt("id"); + String name = response.getString("name"); + String link = response.getString("link"); + String image = response.getString("image"); + String position = response.getString("position"); + int priority = response.getInt("priority"); + NewSponsors item = new NewSponsors(id,name,link,image,position,priority); + sponsorsRead.postValue(item); + } catch (JSONException e) { + Log.e("eRead",e.getMessage()); + e.printStackTrace(); + } + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.e("ErrorSponsorRead",error.getMessage()); + + } + }); + requestQueue.add(jsonObjectRequest); + + + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/apis/VolleyHelper.java b/app/src/main/java/com/nith/hillfair2k22/apis/VolleyHelper.java index cf8d832..95e4730 100644 --- a/app/src/main/java/com/nith/hillfair2k22/apis/VolleyHelper.java +++ b/app/src/main/java/com/nith/hillfair2k22/apis/VolleyHelper.java @@ -335,7 +335,7 @@ public void onResponse(JSONArray response) { try { Log.e("QuizList", String.valueOf(response)); JSONObject jsonObject = response.getJSONObject(i); - a6.add(new Quiz_List(jsonObject.getString("id"), jsonObject.getString("name"), jsonObject.getString("count"), jsonObject.getString("sendCount"), jsonObject.getString("startTime"), jsonObject.getString("endTime"))); + a6.add(new Quiz_List(jsonObject.getString("id"), jsonObject.getString("name"),jsonObject.getString("clubname"), jsonObject.getInt("count"), jsonObject.getInt("sendCount"), jsonObject.getString("startTime"), jsonObject.getString("endTime"))); } catch (JSONException e) { Log.e("QuizListError", String.valueOf(e.getMessage())); @@ -481,7 +481,7 @@ public void onResponse(JSONArray response) { try { Log.e("Quiz_read", String.valueOf(response)); JSONObject jsonObject = response.getJSONObject(i); - a11.add(new Quiz_List(jsonObject.getString("id"), jsonObject.getString("name"), jsonObject.getString("count"), jsonObject.getString("sendCount"), jsonObject.getString("startTime"), jsonObject.getString("endTime"))); + a11.add(new Quiz_List(jsonObject.getString("id"), jsonObject.getString("name"),jsonObject.getString("clubName"), jsonObject.getInt("count"), jsonObject.getInt("sendCount"), jsonObject.getString("startTime"), jsonObject.getString("endTime"))); } catch (JSONException e) { e.printStackTrace(); diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/NewQuizActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/NewQuizActivity.java new file mode 100644 index 0000000..0784300 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/NewQuizActivity.java @@ -0,0 +1,80 @@ +package com.nith.hillfair2k22.screens; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; +import android.widget.Toast; + +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.quiz.QuizStandingsFragment; + +public class NewQuizActivity extends AppCompatActivity { + + private CardView LeaderBoardCard, AnsDetailsCard, QCard, OptionC_Card, OptionB_Card, OptionA_Card, OptionD_Card; + private TextView NxtBtn; + + FragmentManager fragmentManager = getSupportFragmentManager(); + FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction(); + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_new_quiz); + + LeaderBoardCard=findViewById(R.id.score_quiz); + AnsDetailsCard = findViewById(R.id.answer_details_quiz); + QCard = findViewById(R.id.quiz_item_question); + OptionC_Card = findViewById(R.id.option_quiz_a); + OptionB_Card = findViewById(R.id.option_quiz_b); + OptionA_Card = findViewById(R.id.option_quiz_c); + OptionD_Card = findViewById(R.id.option_quiz_d); + + NxtBtn = findViewById(R.id.next_quiz_btn); + + LeaderBoardCard.setOnClickListener(view -> { + + LeaderBoardCard.setVisibility(View.GONE); + AnsDetailsCard.setVisibility(View.GONE); + QCard.setVisibility(View.GONE); + OptionC_Card.setVisibility(View.GONE); + OptionB_Card.setVisibility(View.GONE); + OptionA_Card.setVisibility(View.GONE); + OptionD_Card.setVisibility(View.GONE); + NxtBtn.setVisibility(View.GONE); + + + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.quiz_Activity_container,new QuizStandingsFragment()).commit(); + }); + } + + @Override + public void onBackPressed() { + + Fragment fragment=fragmentManager.findFragmentById(R.id.quiz_Activity_container); + if (fragment!=null){ + fragmentTransaction=fragmentManager.beginTransaction(); + fragmentTransaction.remove(fragment); + fragmentTransaction.commit(); + + LeaderBoardCard.setVisibility(View.VISIBLE); + AnsDetailsCard.setVisibility(View.VISIBLE); + QCard.setVisibility(View.VISIBLE); + OptionC_Card.setVisibility(View.VISIBLE); + OptionB_Card.setVisibility(View.VISIBLE); + OptionA_Card.setVisibility(View.VISIBLE); + OptionD_Card.setVisibility(View.VISIBLE); + NxtBtn.setVisibility(View.VISIBLE); + }else { + super.onBackPressed(); + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/PlayQuizActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/PlayQuizActivity.java new file mode 100644 index 0000000..dbe0770 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/PlayQuizActivity.java @@ -0,0 +1,16 @@ +package com.nith.hillfair2k22.screens; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +import com.nith.hillfair2k22.R; + +public class PlayQuizActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_play_quiz); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/account/EditProfileActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/account/EditProfileActivity.java index 37b7c05..e537122 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/account/EditProfileActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/account/EditProfileActivity.java @@ -2,15 +2,51 @@ import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import com.nith.hillfair2k22.MainActivity; import com.nith.hillfair2k22.R; public class EditProfileActivity extends AppCompatActivity { - + Button btnsave; + EditText etName,etRN,etPhoneNumber,etInstaID; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_profile); + + btnsave=findViewById(R.id.btnsave); + etName=findViewById(R.id.etName); + etPhoneNumber=findViewById(R.id.etPhoneNumber); + etRN=findViewById(R.id.etRN); + etInstaID=findViewById(R.id.etInstaId); + + + btnsave.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + String txtName=etName.getText().toString(); + String txtPhoneNumber=etPhoneNumber.getText().toString(); + String txtRn=etRN.getText().toString(); + String txtInstaID=etInstaID.getText().toString(); + if(TextUtils.isEmpty(txtName)){ + etName.setError("Empty"); + + }else if(TextUtils.isEmpty(txtRn)){ + etRN.setError("Empty"); + + }else if(TextUtils.isEmpty(txtPhoneNumber)){ + etPhoneNumber.setError("Empty"); + }else{ + startActivity(new Intent(EditProfileActivity.this, MainActivity.class)); + } + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/account/ForgotPasswordActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/account/ForgotPasswordActivity.java index e832a02..d36113c 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/account/ForgotPasswordActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/account/ForgotPasswordActivity.java @@ -1,16 +1,71 @@ package com.nith.hillfair2k22.screens.account; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import android.app.ProgressDialog; import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; import com.nith.hillfair2k22.R; public class ForgotPasswordActivity extends AppCompatActivity { + private EditText inputEmail; + private Button btnNext; + FirebaseAuth auth; + private ProgressDialog progressDialog; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forgot_password); + + auth = FirebaseAuth.getInstance(); + inputEmail = findViewById(R.id.etEmail); + btnNext = findViewById(R.id.next); + progressDialog=new ProgressDialog(this); + + btnNext.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + String txt_email = inputEmail.getText().toString().trim(); + if(TextUtils.isEmpty(txt_email)){ +// progressDialog.dismiss(); + Toast.makeText(ForgotPasswordActivity.this,"Enter Email",Toast.LENGTH_LONG).show(); + + } + else{ + progressDialog.setMessage("Sending email to reset password"); + progressDialog.setTitle("Forgot Password"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + auth.sendPasswordResetEmail(txt_email).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if(task.isSuccessful()){ + progressDialog.dismiss(); + Toast.makeText(ForgotPasswordActivity.this,"Email sent to your email to reset Password",Toast.LENGTH_LONG).show(); + }else{ + progressDialog.dismiss(); + Toast.makeText(ForgotPasswordActivity.this,"Try Again",Toast.LENGTH_LONG).show(); + } + } + }); + + } + + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/account/LoginActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/account/LoginActivity.java index b6f206e..a2b4fa8 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/account/LoginActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/account/LoginActivity.java @@ -2,15 +2,108 @@ import androidx.appcompat.app.AppCompatActivity; +import android.app.ProgressDialog; +import android.content.Intent; import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; +import com.nith.hillfair2k22.MainActivity; import com.nith.hillfair2k22.R; public class LoginActivity extends AppCompatActivity { + private EditText inputEmail,inputPassword; + private Button btnSignIn; + private TextView lginAcc,forgotPassword; + private FirebaseAuth auth; + private ProgressDialog progrssDialog; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); + + inputEmail=findViewById(R.id.etEmail); + inputPassword=findViewById(R.id.etPassword); + btnSignIn=findViewById(R.id.signin); + lginAcc=findViewById(R.id.lginAcc); + forgotPassword=findViewById(R.id.forgotPassword); + auth=FirebaseAuth.getInstance(); + progrssDialog=new ProgressDialog(this); + + + lginAcc.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(LoginActivity.this,SignupActivity.class); + startActivity(intent); + } + }); + btnSignIn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String txt_email=inputEmail.getText().toString(); + String txt_password=inputPassword.getText().toString(); +// progress.setVisibility(View.VISIBLE); + if(TextUtils.isEmpty(txt_email) || TextUtils.isEmpty(txt_password)){ + if(TextUtils.isEmpty(txt_email)){ + inputEmail.setError("Empty Email"); + }else{ + inputEmail.setError("Empty Password"); + } + }else { + loginUser(txt_email, txt_password); +// progress.setVisibility(View.INVISIBLE); + } + + } + }); + forgotPassword.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(LoginActivity.this,ForgotPasswordActivity.class); + startActivity(intent); + } + }); + } + private void loginUser(String email, String password) { + progrssDialog.setMessage("Please wait while Login.."); + progrssDialog.setTitle("Login "); + progrssDialog.setCanceledOnTouchOutside(false); + progrssDialog.show(); + auth.signInWithEmailAndPassword(email,password).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(AuthResult authResult) { + + FirebaseUser user=auth.getCurrentUser(); + if(user.isEmailVerified()){ + progrssDialog.dismiss(); + Toast.makeText(LoginActivity.this,"Login Successful" ,Toast.LENGTH_SHORT).show(); + startActivity(new Intent(LoginActivity.this, EditProfileActivity.class)); + finish(); + }else{ + progrssDialog.dismiss(); + inputEmail.setError("Email not Verified"); + user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + Toast.makeText(LoginActivity.this,"Email not verified Confirm your email",Toast.LENGTH_LONG).show(); + } + }); + auth.signOut(); + } + } + }); + } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/account/SignupActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/account/SignupActivity.java index c5df6e1..4bdd147 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/account/SignupActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/account/SignupActivity.java @@ -1,16 +1,117 @@ package com.nith.hillfair2k22.screens.account; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import android.app.ProgressDialog; +import android.content.Intent; import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.Toast; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseAuthUserCollisionException; +import com.google.firebase.auth.FirebaseUser; import com.nith.hillfair2k22.R; public class SignupActivity extends AppCompatActivity { + private EditText inputEmail,inputPassword,inputConfirmPassword; + private Button btnSignUp; + private FirebaseAuth auth; + private ProgressDialog progrssDialog; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signup); + + + + inputEmail=findViewById(R.id.etEmail); + inputPassword=findViewById(R.id.etPassword); + inputConfirmPassword=findViewById(R.id.etReEnterPassword); + btnSignUp=findViewById(R.id.signup); + auth=FirebaseAuth.getInstance(); + progrssDialog=new ProgressDialog(this); + + + btnSignUp.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String txt_email=inputEmail.getText().toString(); + String txt_password=inputPassword.getText().toString().trim(); + String txt_ConfirmPassword=inputConfirmPassword.getText().toString().trim(); + if(TextUtils.isEmpty(txt_email) || TextUtils.isEmpty(txt_password)){ + + Toast.makeText(SignupActivity.this,"Empty Credentials" , Toast.LENGTH_SHORT).show(); + }else if(txt_password.length() <6){ + inputPassword.setError("Password too short"); + Toast.makeText(SignupActivity.this,"Password too short" ,Toast.LENGTH_SHORT).show(); + }else if(!txt_password.matches(txt_ConfirmPassword)){ + inputConfirmPassword.setError("Password not matching in both fields"); + Toast.makeText(SignupActivity.this,"Password not matching in both fields" ,Toast.LENGTH_SHORT).show(); + } + else{ + int len=txt_email.length(); + if(len>=11) { + boolean isFound=txt_email.contains("@nith.ac.in"); + if(isFound) { +// registerUser(txt_email,txt_password); + + progrssDialog.setMessage("Please wait while Registering..."); + progrssDialog.setTitle("Registration"); + progrssDialog.setCanceledOnTouchOutside(false); + progrssDialog.show(); + + + auth.createUserWithEmailAndPassword(txt_email,txt_password).addOnCompleteListener(new OnCompleteListener() { + + @Override + public void onComplete(@NonNull Task task) { + if(task.isSuccessful()){ + + FirebaseUser user=auth.getCurrentUser(); + user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + + Toast.makeText(SignupActivity.this,"Verification Email Has Been Sent,Confirm your Email",Toast.LENGTH_LONG).show(); + } + }); + progrssDialog.dismiss(); +// Toast.makeText(SignupActivity.this,"Registering User Successful" ,Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(SignupActivity.this,LoginActivity.class); + startActivity(intent); + finish(); + }else{ + progrssDialog.dismiss(); + + if (task.getException() instanceof FirebaseAuthUserCollisionException) { + Toast.makeText(SignupActivity.this,"Provided Email Is Already Registered!", Toast.LENGTH_SHORT).show(); + }else{ + Toast.makeText(SignupActivity.this,"Registeration Failed" ,Toast.LENGTH_SHORT).show(); + } + } + } + }); + + } + else { + inputEmail.setError("Use NITH Email ID"); + Toast.makeText(SignupActivity.this, "Use NITH email ID", Toast.LENGTH_SHORT).show(); + } + } + } + } + }) ; } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/AllEventsAndWorkshopsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/AllEventsAndWorkshopsFragment.java index 25d8ddc..bef32a2 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/AllEventsAndWorkshopsFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/AllEventsAndWorkshopsFragment.java @@ -2,65 +2,130 @@ import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.tabs.TabLayout; import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventsFragmentAdapter; +import com.nith.hillfair2k22.screens.sponsors.SponsorsFragment; +import com.nith.hillfair2k22.screens.teams.TeamsFragment; -/** - * A simple {@link Fragment} subclass. - * Use the {@link AllEventsAndWorkshopsFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class AllEventsAndWorkshopsFragment extends Fragment { +import java.util.concurrent.atomic.AtomicBoolean; - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; +public class AllEventsAndWorkshopsFragment extends Fragment { - public AllEventsAndWorkshopsFragment() { - // Required empty public constructor - } + private TabLayout eventTabLayout; + private ViewPager2 eventViewPager2; + private EventsFragmentAdapter adapter; + + private FloatingActionButton eventFab, teamsFab, sponsorsFab; - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment AllEventsAndWorkshopsFragment. - */ - // TODO: Rename and change types and number of parameters - public static AllEventsAndWorkshopsFragment newInstance(String param1, String param2) { - AllEventsAndWorkshopsFragment fragment = new AllEventsAndWorkshopsFragment(); - Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); - fragment.setArguments(args); - return fragment; - } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } - } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_all_events_and_workshops, container, false); + + + + View view = inflater.inflate(R.layout.fragment_all_events_and_workshops, container, false); + + eventFab = view.findViewById(R.id.btn_team_sponsor); + teamsFab = view.findViewById(R.id.btn_teams); + sponsorsFab = view.findViewById(R.id.btn_sponsors); + + + + + eventTabLayout = view.findViewById(R.id.events_tab_layout); + eventViewPager2 = view.findViewById(R.id.events_TL_viewP2); + + eventTabLayout.addTab(eventTabLayout.newTab().setText("Events")); + eventTabLayout.addTab(eventTabLayout.newTab().setText("Workshops")); + + FragmentManager fragmentManager = getParentFragmentManager(); + adapter = new EventsFragmentAdapter(fragmentManager, getLifecycle()); + eventViewPager2.setAdapter(adapter); + + eventTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + eventViewPager2.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + + } + }); + + eventViewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + @Override + public void onPageSelected(int position) { + eventTabLayout.selectTab(eventTabLayout.getTabAt(position)); + } + }); + + //<--FAB---> + + AtomicBoolean fabExpanded = new AtomicBoolean(false); + eventFab.setOnClickListener(view1 -> { + + if (fabExpanded.get() == false) { + teamsFab.setVisibility(View.VISIBLE); + sponsorsFab.setVisibility(View.VISIBLE); + eventFab.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.ic_cancel)); + fabExpanded.set(true); + } else { + teamsFab.setVisibility(View.GONE); + sponsorsFab.setVisibility(View.GONE); + eventFab.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.ic_three_dots)); + fabExpanded.set(false); + } + + + }); + + teamsFab.setOnClickListener(view1 -> { + changeFragment(new TeamsFragment()); + + }); + + sponsorsFab.setOnClickListener(view1 -> { + changeFragment(new SponsorsFragment()); + + }); + + return view; + } + + + + private void changeFragment(Fragment fragment) { + FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + //TODO: change replace id to --"fragment_frame_layout"-- + fragmentTransaction.replace(R.id.all_events_workshop_RL, fragment); + fragmentTransaction.addToBackStack(null); + fragmentTransaction.commit(); + } + + } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventAndWorkshopDetailsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventAndWorkshopDetailsFragment.java index 0ddffd9..8868e3a 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventAndWorkshopDetailsFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventAndWorkshopDetailsFragment.java @@ -1,66 +1,58 @@ package com.nith.hillfair2k22.screens.eventsAndWorkshops; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import androidx.fragment.app.Fragment; +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 com.nith.hillfair2k22.R; +import com.squareup.picasso.Picasso; -/** - * A simple {@link Fragment} subclass. - * Use the {@link EventAndWorkshopDetailsFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class EventAndWorkshopDetailsFragment extends Fragment { - - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; - - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; - public EventAndWorkshopDetailsFragment() { - // Required empty public constructor - } +public class EventAndWorkshopDetailsFragment extends Fragment { - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment EventAndWorkshopDetailsFragment. - */ - // TODO: Rename and change types and number of parameters - public static EventAndWorkshopDetailsFragment newInstance(String param1, String param2) { - EventAndWorkshopDetailsFragment fragment = new EventAndWorkshopDetailsFragment(); - Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); - fragment.setArguments(args); - return fragment; - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } - } + private TextView titleTV, descriptionTV, regBtn; + private ImageView eventImage; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_event_and_workshop_details, container, false); - } -} \ No newline at end of file + View view = inflater.inflate(R.layout.fragment_event_and_workshop_details, container, false); + + titleTV =view.findViewById(R.id.title_event_details_TV); + descriptionTV =view.findViewById(R.id.description_TV); + eventImage=view.findViewById(R.id.event_image); + regBtn=view.findViewById(R.id.reg_btn); + + String title = getArguments().getString("Title"); + String imageUrl = getArguments().getString("ImageUrl"); + String description = getArguments().getString("description"); + String regUrl = getArguments().getString("regUrl"); + + titleTV.setText(title); + descriptionTV.setText(description); + if (imageUrl.isEmpty()){ +// Picasso.get().load(imgUrl.replace("http", "https")).into(holder.sponsorImage); + }else { + Picasso.get().load(imageUrl).into(eventImage); + } + regBtn.setOnClickListener(view1 -> { + Uri uri = Uri.parse(regUrl); + if (!regUrl.isEmpty()){ + startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } + }); + + + + return view; + }} diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventsFragment.java new file mode 100644 index 0000000..6ec6c62 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/EventsFragment.java @@ -0,0 +1,93 @@ +package com.nith.hillfair2k22.screens.eventsAndWorkshops; + + +import static com.nith.hillfair2k22.apis.EventsVolleyHelper.eventList; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.widget.Button; +import android.widget.Toast; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventAdapter; +import com.nith.hillfair2k22.apis.EventsVolleyHelper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter; +import jp.wasabeef.recyclerview.adapters.ScaleInAnimationAdapter; + + +public class EventsFragment extends Fragment { + + private RecyclerView eventsRV; + + private EventAdapter eventsAdapter; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_events, container, false); + + EventsVolleyHelper eventsVolleyHelper = new EventsVolleyHelper(getContext()); + eventsVolleyHelper.getEvents(); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List eventsList) { + Log.e("abcd43", String.valueOf(eventsList)); + for (int i = 0; i < eventsList.size(); i++) { + Log.e("nnn", eventsList.get(i).getClubName()); + } + + List onlyEventList = new ArrayList(); + + for (int i = 0; i < eventsList.size(); i++) { + if (eventsList.get(i).getType() == 0) { + onlyEventList.add(eventsList.get(i)); + } + } + + eventsAdapter = new EventAdapter(onlyEventList, getActivity()); + + LinearLayoutManager manager = new LinearLayoutManager(getActivity()); + eventsRV.setHasFixedSize(true); + + eventsRV.setLayoutManager(manager); + + // <-----ANIMATIONS----> + + AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(eventsAdapter); + animationAdapter.setDuration(1000); + animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); + animationAdapter.setFirstOnly(false); + eventsRV.setAdapter(animationAdapter); + } + }; + eventList.observe(getActivity(), observer); + + + eventsRV = view.findViewById(R.id.events_RecV); + + + return view; + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/WorkshopFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/WorkshopFragment.java new file mode 100644 index 0000000..15b6317 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/eventsAndWorkshops/WorkshopFragment.java @@ -0,0 +1,86 @@ +package com.nith.hillfair2k22.screens.eventsAndWorkshops; + + +import static com.nith.hillfair2k22.apis.EventsVolleyHelper.eventList; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.widget.Button; + +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventAdapter; +import com.nith.hillfair2k22.apis.EventsVolleyHelper; + +import java.util.ArrayList; +import java.util.List; + +import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter; +import jp.wasabeef.recyclerview.adapters.SlideInBottomAnimationAdapter; + + +public class WorkshopFragment extends Fragment { + + + private RecyclerView workshopsRV; + + private EventAdapter workshopsAdapter; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_workshop, container, false); + + workshopsRV = view.findViewById(R.id.workshop_RecV); + + EventsVolleyHelper eventsVolleyHelper = new EventsVolleyHelper(getContext()); + eventsVolleyHelper.getEvents(); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List eventsList) { + Log.e("abcd43", String.valueOf(eventsList)); + for (int i = 0; i < eventsList.size(); i++) { + Log.e("nnn", eventsList.get(i).getClubName()); + } + + List onlyWorkshopList = new ArrayList(); + + for (int i = 0; i < eventsList.size(); i++) { + if (eventsList.get(i).getType() == 1) { + onlyWorkshopList.add(eventsList.get(i)); + } + } + + workshopsAdapter = new EventAdapter(onlyWorkshopList, getActivity()); + + LinearLayoutManager manager = new LinearLayoutManager(getActivity()); + workshopsRV.setHasFixedSize(true); + + workshopsRV.setLayoutManager(manager); + + + SlideInBottomAnimationAdapter animationAdapter = new SlideInBottomAnimationAdapter(workshopsAdapter); + animationAdapter.setDuration(1000); + animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); + animationAdapter.setFirstOnly(false); + workshopsRV.setAdapter(animationAdapter); + } + }; + eventList.observe(getActivity(), observer); + + + return view; + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/home/CommentUserFeedFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/home/CommentUserFeedFragment.java new file mode 100644 index 0000000..ab6b409 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/home/CommentUserFeedFragment.java @@ -0,0 +1,135 @@ +package com.nith.hillfair2k22.screens.home; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.Toast; +import android.widget.ToggleButton; + +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.CustomAdapter; +import com.nith.hillfair2k22.adapters.NewCustomAdapter; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link CommentUserFeedFragment#} factory method to + * create an instance of this fragment. + */ +public class CommentUserFeedFragment extends AppCompatActivity { + ImageView img; + ImageView img2; + EditText editText; + ToggleButton togglebtn; +// +// // TODO: Rename parameter arguments, choose names that match +// // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +// private static final String ARG_PARAM1 = "param1"; +// private static final String ARG_PARAM2 = "param2"; +// +// // TODO: Rename and change types of parameters +// private String mParam1; +// private String mParam2; +// +// public CommentUserFeedFragment() { +// // Required empty public constructor +// } +// +// /** +// * Use this factory method to create a new instance of +// * this fragment using the provided parameters. +// * +// * @param param1 Parameter 1. +// * @param param2 Parameter 2. +// * @return A new instance of fragment CommentUserFeedFragment. +// */ +// // TODO: Rename and change types and number of parameters +// public static CommentUserFeedFragment newInstance(String param1, String param2) { +// CommentUserFeedFragment fragment = new CommentUserFeedFragment(); +// Bundle args = new Bundle(); +// args.putString(ARG_PARAM1, param1); +// args.putString(ARG_PARAM2, param2); +// fragment.setArguments(args); +// return fragment; +// } + + UserComments c1=new UserComments("abc","xyz"); + UserComments c2=new UserComments("abc","xyz"); + UserComments c3=new UserComments("abc","xyz"); + UserComments c4=new UserComments("abc","xyz"); + UserComments c5=new UserComments("abc","xyz"); + UserComments c6=new UserComments("abc","xyz"); + UserComments [] usercomments={c1,c2,c3,c4,c5,c6}; + RecyclerView recyclerView; +// +// @Override +// public void onCreate(Bundle savedInstanceState) { +// super.onCreate(savedInstanceState); +// if (getArguments() != null) { +// mParam1 = getArguments().getString(ARG_PARAM1); +// mParam2 = getArguments().getString(ARG_PARAM2); +// } +// } + +// @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view= inflater.inflate(R.layout.fragment_comment_user_feed, container, false); + recyclerView=view.findViewById(R.id.user_comment_recyclerview); + recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); + NewCustomAdapter ad=new NewCustomAdapter(usercomments); + recyclerView.setAdapter(ad); + + return inflater.inflate(R.layout.fragment_comment_user_feed, container, false); + } +@Override +protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fragment_comment_user_feed); + Intent intent=getIntent(); + boolean like=intent.getBooleanExtra("post_like",false); + togglebtn=findViewById(R.id.heart_icon); + togglebtn.setChecked(like); + editText=findViewById(R.id.user_comment_write_your_comment); + + Log.e( "onCreate: ",like+"" ); + img2=findViewById(R.id.user_comment_post_comment_icon); + + img2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Toast.makeText(CommentUserFeedFragment.this, "Comment added", Toast.LENGTH_SHORT).show(); + editText.setText(""); + + } + }); + img=findViewById(R.id.user_comment_message_icon); + img.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + // Inflate the layout for this fragment + + recyclerView=findViewById(R.id.user_comment_recyclerview); + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + NewCustomAdapter ad=new NewCustomAdapter(usercomments); + recyclerView.setAdapter(ad); + + + +} + +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/home/Contact.java b/app/src/main/java/com/nith/hillfair2k22/screens/home/Contact.java new file mode 100644 index 0000000..adc3c27 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/home/Contact.java @@ -0,0 +1,10 @@ +package com.nith.hillfair2k22.screens.home; + +public class Contact { + public String name; + public String caption; + Contact(String name,String caption){ + this.name=name; + this.caption=caption; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/home/CreateNewFeedFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/home/CreateNewFeedFragment.java index 6e4b378..d732e1b 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/home/CreateNewFeedFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/home/CreateNewFeedFragment.java @@ -1,30 +1,37 @@ package com.nith.hillfair2k22.screens.home; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.Toast; import com.nith.hillfair2k22.R; /** * A simple {@link Fragment} subclass. - * Use the {@link CreateNewFeedFragment#newInstance} factory method to + * Use the {@link CreateNewFeedFragment#} factory method to * create an instance of this fragment. */ -public class CreateNewFeedFragment extends Fragment { +public class CreateNewFeedFragment extends AppCompatActivity { + ImageView imgaeview1; + ImageView imageview2; + ImageView imageview3; + int SELECT_PICTURE = 200; // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; + // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; + public CreateNewFeedFragment() { // Required empty public constructor @@ -34,33 +41,89 @@ public CreateNewFeedFragment() { * Use this factory method to create a new instance of * this fragment using the provided parameters. * - * @param param1 Parameter 1. - * @param param2 Parameter 2. + * * @return A new instance of fragment CreateNewFeedFragment. */ // TODO: Rename and change types and number of parameters - public static CreateNewFeedFragment newInstance(String param1, String param2) { - CreateNewFeedFragment fragment = new CreateNewFeedFragment(); - Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); - fragment.setArguments(args); - return fragment; - } +// public static CreateNewFeedFragment newInstance(String param1, String param2) { +// CreateNewFeedFragment fragment = new CreateNewFeedFragment(); +// Bundle args = new Bundle(); +// args.putString(ARG_PARAM1, param1); +// args.putString(ARG_PARAM2, param2); +// fragment.setArguments(args); +// return fragment; +// } +// +// @Override +// public void onCreate(Bundle savedInstanceState) { +// super.onCreate(savedInstanceState); +// if (getArguments() != null) { +// mParam1 = getArguments().getString(ARG_PARAM1); +// mParam2 = getArguments().getString(ARG_PARAM2); +// } +// } +// +// @Override +// public View onCreateView(LayoutInflater inflater, ViewGroup container, +// Bundle savedInstanceState) { +// // Inflate the layout for this fragment +// return inflater.inflate(R.layout.fragment_create_new_feed, container, false); +// } @Override - public void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } + setContentView(R.layout.fragment_create_new_feed); + imgaeview1=findViewById(R.id.btn_user_post_image); + imgaeview1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Toast.makeText(CreateNewFeedFragment.this, "Image Uploaded", Toast.LENGTH_SHORT).show(); + finish(); + } + }); + imageview2= findViewById(R.id.user_post_back_icon); + imageview2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + imageview3=findViewById(R.id.user_post_image_upload); + imageview3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + imageChooser(); + + } + + }); + } - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_create_new_feed, container, false); + void imageChooser(){ +// Intent i = new Intent(Intent.ACTION_PICK, +// android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); +// final int ACTIVITY_SELECT_IMAGE = 1234; +// startActivityForResult(i, ACTIVITY_SELECT_IMAGE); + Intent i=new Intent(); + i.setType("image/*"); + i.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(i,"Select Picture"),SELECT_PICTURE); } + public void onActivityResult(int requestCode,int resultCode,Intent data) { + + super.onActivityResult(requestCode, resultCode, data); + + if(resultCode==RESULT_OK){ + if(resultCode==SELECT_PICTURE){ + Uri selectedImageUri=data.getData(); + if(null!=selectedImageUri){ + imageview3.setImageURI(selectedImageUri); + } + } + } + } + + } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/home/UserComments.java b/app/src/main/java/com/nith/hillfair2k22/screens/home/UserComments.java new file mode 100644 index 0000000..d90691b --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/home/UserComments.java @@ -0,0 +1,10 @@ +package com.nith.hillfair2k22.screens.home; + +public class UserComments { + public String username; + public String comments; + UserComments(String username,String comments){ + this.username=username; + this.comments=comments; + } +} diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/home/UserFeedFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/home/UserFeedFragment.java index 78b2ed9..7411f2c 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/home/UserFeedFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/home/UserFeedFragment.java @@ -1,35 +1,70 @@ package com.nith.hillfair2k22.screens.home; +import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ToggleButton; +import com.nith.hillfair2k22.MainActivity; import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.CustomAdapter; /** * A simple {@link Fragment} subclass. * Use the {@link UserFeedFragment#newInstance} factory method to * create an instance of this fragment. */ + + + + public class UserFeedFragment extends Fragment { + + + // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; + private ImageView imageview; + private ImageView imageview2; + + + + // TODO: Rename and change types of parameters private String mParam1; private String mParam2; + ImageView imageView; + public UserFeedFragment() { // Required empty public constructor } + Contact o1=new Contact("name","caption"); + Contact o2=new Contact("name","caption"); + Contact o3=new Contact("name","caption"); + Contact o4=new Contact("name","caption"); + Contact o5=new Contact("name","caption"); + Contact o6=new Contact("name","caption"); + Contact o7=new Contact("name","caption"); + Contact o8=new Contact("name","caption"); + Contact o9=new Contact("name","caption"); + Contact [] contacts={o1,o2,o3,o4,o5,o6,o7,o8,o9}; + RecyclerView recyclerView; + + /** * Use this factory method to create a new instance of * this fragment using the provided parameters. @@ -55,12 +90,37 @@ public void onCreate(Bundle savedInstanceState) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } + + + + + } + public void onCustomToggleClick(View view){ + } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_user_feed, container, false); + View view= inflater.inflate(R.layout.fragment_user_feed, container, false); + recyclerView=view.findViewById(R.id.recyclerView); + recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); + CustomAdapter ad=new CustomAdapter(contacts); + recyclerView.setAdapter(ad); + imageview= view.findViewById(R.id.btn_add_new_post); + + imageview.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(getActivity(),CreateNewFeedFragment.class); + + startActivity(intent); + } + }); + + + return view; + } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/quiz/AllQuizzesFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/quiz/AllQuizzesFragment.java index dfe38ee..b1f78c0 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/quiz/AllQuizzesFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/quiz/AllQuizzesFragment.java @@ -1,66 +1,117 @@ package com.nith.hillfair2k22.screens.quiz; +import static com.nith.hillfair2k22.apis.EventsVolleyHelper.eventList; +import static com.nith.hillfair2k22.apis.VolleyHelper.quiz_listArrayList; + import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.Models.Quiz_List; import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventAdapter; +import com.nith.hillfair2k22.adapters.QuizAdapter; +import com.nith.hillfair2k22.apis.EventsVolleyHelper; +import com.nith.hillfair2k22.apis.VolleyHelper; -/** - * A simple {@link Fragment} subclass. - * Use the {@link AllQuizzesFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class AllQuizzesFragment extends Fragment { +import java.util.ArrayList; +import java.util.List; - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; +import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter; - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; - public AllQuizzesFragment() { - // Required empty public constructor - } +public class AllQuizzesFragment extends Fragment { - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment AllQuizzesFragment. - */ - // TODO: Rename and change types and number of parameters - public static AllQuizzesFragment newInstance(String param1, String param2) { - AllQuizzesFragment fragment = new AllQuizzesFragment(); - Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); - fragment.setArguments(args); - return fragment; - } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } - } + private RecyclerView quizRV; + + private QuizAdapter quizAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_all_quizzes, container, false); + View view = inflater.inflate(R.layout.fragment_all_quizzes, container, false); + + quizRV = view.findViewById(R.id.all_quiz_RV); + + + + + VolleyHelper volleyHelper = new VolleyHelper(getContext()); + volleyHelper.getQuiz_List(); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List quiz_lists) { + Log.e("abcd43", String.valueOf(quiz_lists)); + for (int i = 0; i < quiz_lists.size(); i++) { + Log.e("nnn", quiz_lists.get(i).getClubName()); + } + +// List onlyEventList = new ArrayList(); +// +// for (int i = 0; i < eventsList.size(); i++) { +// if (eventsList.get(i).getType() == 0) { +// onlyEventList.add(eventsList.get(i)); +// } +// } + + quizAdapter = new QuizAdapter((ArrayList) quiz_lists, getActivity()); + + LinearLayoutManager manager = new LinearLayoutManager(getActivity()); + quizRV.setHasFixedSize(true); + + quizRV.setLayoutManager(manager); + + // <-----ANIMATIONS----> + + AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(quizAdapter); + animationAdapter.setDuration(1000); + animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); + animationAdapter.setFirstOnly(false); + quizRV.setAdapter(animationAdapter); + } + }; + quiz_listArrayList.observe(getActivity(), observer); + + + + return view; } + +// private void getQuizData() { +// for (int i = 0; i < 19; i++) { +// quizListArrayList.add(new Quiz_List("id", "quiz_name", "count", "sendCount", "startTime","endTime")); +// } +// } + +// private void buildQuizRV() { +// +// quizAdapter = new QuizAdapter(quizListArrayList, getActivity()); +// +// LinearLayoutManager manager = new LinearLayoutManager(getActivity()); +// quizRV.setHasFixedSize(true); +// +// quizRV.setLayoutManager(manager); +// +// // <-----ANIMATIONS----> +// +// AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(quizAdapter); +// animationAdapter.setDuration(1000); +// animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); +// animationAdapter.setFirstOnly(false); +// quizRV.setAdapter(animationAdapter); +// +// +// +// } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/quiz/QuizStandingsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/quiz/QuizStandingsFragment.java index 6fd6a8b..9561859 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/quiz/QuizStandingsFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/quiz/QuizStandingsFragment.java @@ -2,65 +2,79 @@ import android.os.Bundle; +import androidx.activity.OnBackPressedCallback; +import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.widget.Toast; +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.Models.Quiz_Leaderboard_Results_Read; import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventAdapter; +import com.nith.hillfair2k22.adapters.LeaderboardAdapter; -/** - * A simple {@link Fragment} subclass. - * Use the {@link QuizStandingsFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class QuizStandingsFragment extends Fragment { +import java.util.ArrayList; - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; +import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter; - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; - public QuizStandingsFragment() { - // Required empty public constructor - } +public class QuizStandingsFragment extends Fragment { + + private RecyclerView LeaderboardRV; + + private LeaderboardAdapter leaderboardAdapter; + private ArrayList LBArrayList; - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment QuizStandingsFragment. - */ - // TODO: Rename and change types and number of parameters - public static QuizStandingsFragment newInstance(String param1, String param2) { - QuizStandingsFragment fragment = new QuizStandingsFragment(); - Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); - fragment.setArguments(args); - return fragment; - } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } - } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_quiz_standings, container, false); + View view = inflater.inflate(R.layout.fragment_quiz_standings, container, false); + + LeaderboardRV = view.findViewById(R.id.leader_board_RV); + + LBArrayList = new ArrayList<>(); + + getLB_Data(); + + buildLB_RV(); + return view; + + } + + private void buildLB_RV() { + + leaderboardAdapter = new LeaderboardAdapter(LBArrayList, getActivity()); + + LinearLayoutManager manager = new LinearLayoutManager(getActivity()); + LeaderboardRV.setHasFixedSize(true); + + LeaderboardRV.setLayoutManager(manager); + + // <-----ANIMATIONS----> + + AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(leaderboardAdapter); + animationAdapter.setDuration(1000); + animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); + animationAdapter.setFirstOnly(false); + LeaderboardRV.setAdapter(animationAdapter); + + + } + + private void getLB_Data() { + + for (int i = 0; i < 19; i++) { + LBArrayList.add(new Quiz_Leaderboard_Results_Read(i, "Name", "https://media.geeksforgeeks.org/img-practice/banner/dsa-self-paced-thumbnail.png", i, "timestamp", "quiz ")); + } } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/splashScreen/SplashScreenActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/splashScreen/SplashScreenActivity.java index 8c475b8..e3974d2 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/splashScreen/SplashScreenActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/splashScreen/SplashScreenActivity.java @@ -6,11 +6,15 @@ import android.os.Bundle; import android.os.Handler; +import com.google.firebase.FirebaseApp; +import com.google.firebase.auth.FirebaseAuth; import com.nith.hillfair2k22.MainActivity; import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.screens.account.LoginActivity; public class SplashScreenActivity extends AppCompatActivity { + private FirebaseAuth auth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -19,15 +23,22 @@ protected void onCreate(Bundle savedInstanceState) { new Handler().postDelayed(new Runnable() { @Override public void run() { - Intent i=new Intent(SplashScreenActivity.this, - MainActivity.class); - //Intent is used to switch from one activity to another. - - startActivity(i); - //invoke the SecondActivity. - - finish(); - //the current activity will get finished. + auth = FirebaseAuth.getInstance(); + if (auth.getCurrentUser() == null) { + startActivity(new Intent(SplashScreenActivity.this, LoginActivity.class)); + finish(); + } + else { + Intent i = new Intent(SplashScreenActivity.this, + MainActivity.class); + //Intent is used to switch from one activity to another. + + startActivity(i); + //invoke the SecondActivity. + + finish(); + //the current activity will get finished. + } } }, 4000); } diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/sponsors/SponsorsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/sponsors/SponsorsFragment.java new file mode 100644 index 0000000..4aa8c90 --- /dev/null +++ b/app/src/main/java/com/nith/hillfair2k22/screens/sponsors/SponsorsFragment.java @@ -0,0 +1,90 @@ +package com.nith.hillfair2k22.screens.sponsors; + +import static com.nith.hillfair2k22.apis.EventsVolleyHelper.eventList; +import static com.nith.hillfair2k22.apis.SponsorVolleyHelper.sponsorList; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.widget.RelativeLayout; + +import com.nith.hillfair2k22.Models.Events; +import com.nith.hillfair2k22.Models.NewSponsors; +import com.nith.hillfair2k22.Models.Sponsor; +import com.nith.hillfair2k22.R; +import com.nith.hillfair2k22.adapters.EventAdapter; +import com.nith.hillfair2k22.adapters.SponsorsAdapter; +import com.nith.hillfair2k22.apis.EventsVolleyHelper; +import com.nith.hillfair2k22.apis.SponsorVolleyHelper; +import com.nith.hillfair2k22.screens.eventsAndWorkshops.AllEventsAndWorkshopsFragment; + +import java.util.ArrayList; +import java.util.List; + +import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter; + + +public class SponsorsFragment extends Fragment { + + private RecyclerView sponsorsRV; + private RelativeLayout sponsorRL; + + private SponsorsAdapter sponsorsAdapter; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sponsors, container, false); + + + sponsorRL = view.findViewById(R.id.sponsors_RL); + + sponsorsRV = view.findViewById(R.id.sponsors_RecV); + + SponsorVolleyHelper sponsorVolleyHelper = new SponsorVolleyHelper(getContext()); + sponsorVolleyHelper.getSponsors(); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List sponsorsList) { + Log.e("abcd43", String.valueOf(sponsorsList)); + for (int i = 0; i < sponsorsList.size(); i++) { + Log.e("nnn", sponsorsList.get(i).getImage()); + } + + + + sponsorsAdapter = new SponsorsAdapter(sponsorsList, getActivity()); + + LinearLayoutManager manager = new LinearLayoutManager(getActivity()); + sponsorsRV.setHasFixedSize(true); + + sponsorsRV.setLayoutManager(manager); + + // <-----ANIMATIONS----> + + AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(sponsorsAdapter); + animationAdapter.setDuration(1000); + animationAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); + animationAdapter.setFirstOnly(false); + sponsorsRV.setAdapter(animationAdapter); + } + }; + sponsorList.observe(getActivity(), observer); + + + + return view; + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamDetailsActivity.java b/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamDetailsActivity.java index bf03f11..bf5669b 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamDetailsActivity.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamDetailsActivity.java @@ -1,6 +1,8 @@ package com.nith.hillfair2k22.screens.teams; import static android.icu.lang.UCharacter.GraphemeClusterBreak.T; +import static com.nith.hillfair2k22.apis.MemberVolleyHelper.memberList; +import static com.nith.hillfair2k22.apis.MemberVolleyHelper.teamMemberList; import static com.nith.hillfair2k22.screens.teams.TeamsFragment.EXTRA_TEAM_NAME; import static java.security.AccessController.getContext; @@ -9,10 +11,14 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.StaggeredGridLayoutManager; +import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.widget.TextView; + +import com.nith.hillfair2k22.Models.Members_List; +import com.nith.hillfair2k22.Models.NewMembersList; import com.nith.hillfair2k22.R; import org.json.JSONArray; import org.json.JSONException; @@ -24,9 +30,14 @@ import com.nith.hillfair2k22.adapters.TeamDetailAdapter; import java.util.ArrayList; import java.util.List; -public class TeamDetailsActivity extends AppCompatActivity { - private final List mTeamDetailList = new ArrayList<>(); + +import com.nith.hillfair2k22.apis.MemberVolleyHelper; +import com.nith.hillfair2k22.apis.VolleyHelper; +public class TeamDetailsActivity extends AppCompatActivity { + private final List membersLists = new ArrayList<>(); private static final String TAG = "TeamDetailsActivity"; + TeamDetailAdapter teamDetailAdapter; + Context context= TeamDetailsActivity.this; @Override @@ -38,49 +49,29 @@ protected void onCreate(Bundle savedInstanceState) { String Team_Name = intent.getStringExtra(EXTRA_TEAM_NAME); TextView textViewTeamName = findViewById(R.id.team_name1); textViewTeamName.setText(Team_Name); + MemberVolleyHelper n1 = new MemberVolleyHelper(TeamDetailsActivity.this); + n1.getTeamMember(Team_Name); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List newMembersList) { + Log.e("abcd43",String.valueOf(newMembersList)); + Log.e("abcd45",String.valueOf(newMembersList.get(0).getImage())); + for(int i=0;i) teamDetailAdapter); - StaggeredGridLayoutManager gridLayoutManager = - new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); - recyclerView.setLayoutManager(gridLayoutManager); - addTeamDataFromJSON(); - } - private void addTeamDataFromJSON() { - try { - String jsonDataString= readJSONDataFromFile(); - JSONArray jsonArray= new JSONArray(jsonDataString); - for(int i=0 ; i< jsonArray.length();++i){ - System.out.println(jsonArray.get(i).toString()); - JSONObject itemObj1 = jsonArray.getJSONObject(i); - String team_Name = itemObj1.getString("Team_Name"); - String teamMemName = itemObj1.getString("Team_mem_Name"); - String teamMemImgUrl = itemObj1.getString("team member image"); - String designation = itemObj1.getString("designation"); - TeamDetail teamDetailData = new TeamDetail(team_Name, teamMemName, designation, teamMemImgUrl); - mTeamDetailList.add(teamDetailData) ; - - } - } catch (JSONException | IOException e) { - Log.d(TAG,"addTeamDataFromJSON:", e); - } - } - - // function to read teams' json data from file - private String readJSONDataFromFile() throws IOException { - InputStream inputStream = null; - StringBuilder builder = new StringBuilder(); - try { - String jsonString = null; - inputStream = getResources().openRawResource(R.raw.teamdata); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"UTF-8")); - while ((jsonString = bufferedReader.readLine()) != null){ - builder.append(jsonString); - } - } finally { - if (inputStream != null) { - inputStream.close(); - } - } return new String(builder); } } \ No newline at end of file diff --git a/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamsFragment.java b/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamsFragment.java index 7812cc2..81f136d 100644 --- a/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamsFragment.java +++ b/app/src/main/java/com/nith/hillfair2k22/screens/teams/TeamsFragment.java @@ -1,5 +1,8 @@ package com.nith.hillfair2k22.screens.teams; +import static com.nith.hillfair2k22.apis.MemberVolleyHelper.memberList; +import static com.nith.hillfair2k22.apis.MemberVolleyHelper.teamList; + import android.content.Intent; import android.os.Bundle; @@ -13,8 +16,11 @@ import android.view.View; import android.view.ViewGroup; +import com.nith.hillfair2k22.Models.NewMembersList; +import com.nith.hillfair2k22.Models.Teams; import com.nith.hillfair2k22.R; import com.nith.hillfair2k22.adapters.TeamAdapter; +import com.nith.hillfair2k22.apis.MemberVolleyHelper; import org.json.JSONArray; import org.json.JSONException; @@ -29,74 +35,51 @@ public class TeamsFragment extends Fragment implements TeamAdapter.OnItemClickListener { public static final String EXTRA_TEAM_NAME="Team_Name"; - private final List mTeamList = new ArrayList<>(); + private final List mTeamList = new ArrayList<>(); private RecyclerView recyclerView; private TeamAdapter teamAdapter; private static final String TAG="MainActivity"; public TeamsFragment() { // Required empty public constructor } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view=inflater.inflate(R.layout.fragment_teams, container, false); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); - TeamAdapter teamAdapter = new TeamAdapter(mTeamList,getContext()); - recyclerView.setAdapter(teamAdapter); - teamAdapter.setItemOnClickListener(TeamsFragment.this); - StaggeredGridLayoutManager gridLayoutManager = - new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); - recyclerView.setLayoutManager(gridLayoutManager); - addTeamDataFromJSON(); - return view; + MemberVolleyHelper n2 = new MemberVolleyHelper (getContext()); + n2.getTeamList(); + final androidx.lifecycle.Observer> observer = new androidx.lifecycle.Observer>() { + @Override + public void onChanged(List newMembersList1) { + Log.e("abcd43",String.valueOf(newMembersList1)); + for(int i=0;i + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bx_arrow_back_svg.xml b/app/src/main/res/drawable/bx_arrow_back_svg.xml new file mode 100644 index 0000000..2df0e0a --- /dev/null +++ b/app/src/main/res/drawable/bx_arrow_back_svg.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/circular_post_spec.png b/app/src/main/res/drawable/circular_post_spec.png new file mode 100644 index 0000000..fe1ab4d Binary files /dev/null and b/app/src/main/res/drawable/circular_post_spec.png differ diff --git a/app/src/main/res/drawable/coin_golden.png b/app/src/main/res/drawable/coin_golden.png new file mode 100644 index 0000000..44754fa Binary files /dev/null and b/app/src/main/res/drawable/coin_golden.png differ diff --git a/app/src/main/res/drawable/ellipse_quiz.png b/app/src/main/res/drawable/ellipse_quiz.png new file mode 100644 index 0000000..5b4c311 Binary files /dev/null and b/app/src/main/res/drawable/ellipse_quiz.png differ diff --git a/app/src/main/res/drawable/events_tab.xml b/app/src/main/res/drawable/events_tab.xml new file mode 100644 index 0000000..3affba8 --- /dev/null +++ b/app/src/main/res/drawable/events_tab.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/full_spec_poster.png b/app/src/main/res/drawable/full_spec_poster.png new file mode 100644 index 0000000..2c826fb Binary files /dev/null and b/app/src/main/res/drawable/full_spec_poster.png differ diff --git a/app/src/main/res/drawable/ic_add.xml b/app/src/main/res/drawable/ic_add.xml new file mode 100644 index 0000000..bbc546c --- /dev/null +++ b/app/src/main/res/drawable/ic_add.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml b/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml new file mode 100644 index 0000000..bab545a --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_brightness_1_24.xml b/app/src/main/res/drawable/ic_baseline_brightness_1_24.xml new file mode 100644 index 0000000..5d957c4 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_brightness_1_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_chat_24.xml b/app/src/main/res/drawable/ic_baseline_chat_24.xml new file mode 100644 index 0000000..26208ad --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_chat_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_check_24.xml b/app/src/main/res/drawable/ic_baseline_check_24.xml new file mode 100644 index 0000000..0432fa6 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_check_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_clear_24.xml b/app/src/main/res/drawable/ic_baseline_clear_24.xml new file mode 100644 index 0000000..16d6d37 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_clear_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_delete_24.xml b/app/src/main/res/drawable/ic_baseline_delete_24.xml new file mode 100644 index 0000000..3c4030b --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_delete_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_message_24.xml b/app/src/main/res/drawable/ic_baseline_message_24.xml new file mode 100644 index 0000000..694aa01 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_message_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_more_horiz_24.xml b/app/src/main/res/drawable/ic_baseline_more_horiz_24.xml new file mode 100644 index 0000000..6439bcc --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_more_horiz_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_supervised_user_circle_24.xml b/app/src/main/res/drawable/ic_baseline_supervised_user_circle_24.xml new file mode 100644 index 0000000..61b9bbc --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_supervised_user_circle_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_cancel.xml b/app/src/main/res/drawable/ic_cancel.xml new file mode 100644 index 0000000..49e6aad --- /dev/null +++ b/app/src/main/res/drawable/ic_cancel.xml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_frame_81.xml b/app/src/main/res/drawable/ic_frame_81.xml new file mode 100644 index 0000000..5243f62 --- /dev/null +++ b/app/src/main/res/drawable/ic_frame_81.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_frame_image.xml b/app/src/main/res/drawable/ic_frame_image.xml new file mode 100644 index 0000000..9f308d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_frame_image.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_group_37.xml b/app/src/main/res/drawable/ic_group_37.xml new file mode 100644 index 0000000..bb3ebac --- /dev/null +++ b/app/src/main/res/drawable/ic_group_37.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_three_dots.xml b/app/src/main/res/drawable/ic_three_dots.xml new file mode 100644 index 0000000..ca599ae --- /dev/null +++ b/app/src/main/res/drawable/ic_three_dots.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/item_bottom_nav_background.xml b/app/src/main/res/drawable/item_bottom_nav_background.xml new file mode 100644 index 0000000..7a167e5 --- /dev/null +++ b/app/src/main/res/drawable/item_bottom_nav_background.xml @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/item_event_workshop_card.xml b/app/src/main/res/drawable/item_event_workshop_card.xml new file mode 100644 index 0000000..dabc77a --- /dev/null +++ b/app/src/main/res/drawable/item_event_workshop_card.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/like_fill.xml b/app/src/main/res/drawable/like_fill.xml new file mode 100644 index 0000000..fb660a9 --- /dev/null +++ b/app/src/main/res/drawable/like_fill.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/line_3.xml b/app/src/main/res/drawable/line_3.xml new file mode 100644 index 0000000..6b19b08 --- /dev/null +++ b/app/src/main/res/drawable/line_3.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/line_arrow.png b/app/src/main/res/drawable/line_arrow.png new file mode 100644 index 0000000..a8849a4 Binary files /dev/null and b/app/src/main/res/drawable/line_arrow.png differ diff --git a/app/src/main/res/drawable/line_arrow_right.png b/app/src/main/res/drawable/line_arrow_right.png new file mode 100644 index 0000000..1089d63 Binary files /dev/null and b/app/src/main/res/drawable/line_arrow_right.png differ diff --git a/app/src/main/res/drawable/loading_image.jpg b/app/src/main/res/drawable/loading_image.jpg new file mode 100644 index 0000000..e2fcf31 Binary files /dev/null and b/app/src/main/res/drawable/loading_image.jpg differ diff --git a/app/src/main/res/drawable/number_msg.png b/app/src/main/res/drawable/number_msg.png new file mode 100644 index 0000000..206ffb5 Binary files /dev/null and b/app/src/main/res/drawable/number_msg.png differ diff --git a/app/src/main/res/drawable/puzzle_center.png b/app/src/main/res/drawable/puzzle_center.png new file mode 100644 index 0000000..0fec6ad Binary files /dev/null and b/app/src/main/res/drawable/puzzle_center.png differ diff --git a/app/src/main/res/drawable/puzzle_out_circle.png b/app/src/main/res/drawable/puzzle_out_circle.png new file mode 100644 index 0000000..b3a6376 Binary files /dev/null and b/app/src/main/res/drawable/puzzle_out_circle.png differ diff --git a/app/src/main/res/drawable/quiz_rectangle.png b/app/src/main/res/drawable/quiz_rectangle.png new file mode 100644 index 0000000..874049e Binary files /dev/null and b/app/src/main/res/drawable/quiz_rectangle.png differ diff --git a/app/src/main/res/drawable/send_message.png b/app/src/main/res/drawable/send_message.png new file mode 100644 index 0000000..f18b685 Binary files /dev/null and b/app/src/main/res/drawable/send_message.png differ diff --git a/app/src/main/res/drawable/shadow.xml b/app/src/main/res/drawable/shadow.xml new file mode 100644 index 0000000..0837153 --- /dev/null +++ b/app/src/main/res/drawable/shadow.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sponsors_fab_btn.png b/app/src/main/res/drawable/sponsors_fab_btn.png new file mode 100644 index 0000000..f188d37 Binary files /dev/null and b/app/src/main/res/drawable/sponsors_fab_btn.png differ diff --git a/app/src/main/res/drawable/sponsors_top_tab.xml b/app/src/main/res/drawable/sponsors_top_tab.xml new file mode 100644 index 0000000..7053a4c --- /dev/null +++ b/app/src/main/res/drawable/sponsors_top_tab.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/tab_indicator.xml b/app/src/main/res/drawable/tab_indicator.xml new file mode 100644 index 0000000..6da7bdb --- /dev/null +++ b/app/src/main/res/drawable/tab_indicator.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/team_fab_btn.png b/app/src/main/res/drawable/team_fab_btn.png new file mode 100644 index 0000000..5ae2568 Binary files /dev/null and b/app/src/main/res/drawable/team_fab_btn.png differ diff --git a/app/src/main/res/drawable/three_dots_btn.xml b/app/src/main/res/drawable/three_dots_btn.xml new file mode 100644 index 0000000..34b93ec --- /dev/null +++ b/app/src/main/res/drawable/three_dots_btn.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/toggle_selector.xml b/app/src/main/res/drawable/toggle_selector.xml new file mode 100644 index 0000000..7647b88 --- /dev/null +++ b/app/src/main/res/drawable/toggle_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/transparent_send_message_btn.xml b/app/src/main/res/drawable/transparent_send_message_btn.xml new file mode 100644 index 0000000..2bb98eb --- /dev/null +++ b/app/src/main/res/drawable/transparent_send_message_btn.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/user_feed_caption_outline.xml b/app/src/main/res/drawable/user_feed_caption_outline.xml new file mode 100644 index 0000000..262160b --- /dev/null +++ b/app/src/main/res/drawable/user_feed_caption_outline.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/user_feed_comment_outline.xml b/app/src/main/res/drawable/user_feed_comment_outline.xml new file mode 100644 index 0000000..eb5b903 --- /dev/null +++ b/app/src/main/res/drawable/user_feed_comment_outline.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/user_feed_send_icon.xml b/app/src/main/res/drawable/user_feed_send_icon.xml new file mode 100644 index 0000000..072371e --- /dev/null +++ b/app/src/main/res/drawable/user_feed_send_icon.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/user_icon_view.xml b/app/src/main/res/drawable/user_icon_view.xml new file mode 100644 index 0000000..09dcda0 --- /dev/null +++ b/app/src/main/res/drawable/user_icon_view.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/user_post_image_outline.xml b/app/src/main/res/drawable/user_post_image_outline.xml new file mode 100644 index 0000000..fc02193 --- /dev/null +++ b/app/src/main/res/drawable/user_post_image_outline.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/user_profile.png b/app/src/main/res/drawable/user_profile.png new file mode 100644 index 0000000..eb663ac Binary files /dev/null and b/app/src/main/res/drawable/user_profile.png differ diff --git a/app/src/main/res/drawable/vector.xml b/app/src/main/res/drawable/vector.xml new file mode 100644 index 0000000..90ed81a --- /dev/null +++ b/app/src/main/res/drawable/vector.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/font/akaya_telivigala.xml b/app/src/main/res/font/akaya_telivigala.xml new file mode 100644 index 0000000..acd5639 --- /dev/null +++ b/app/src/main/res/font/akaya_telivigala.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/layout/activity_chat.xml b/app/src/main/res/layout/activity_chat.xml new file mode 100644 index 0000000..94569b0 --- /dev/null +++ b/app/src/main/res/layout/activity_chat.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_edit_profile.xml b/app/src/main/res/layout/activity_edit_profile.xml index 198f01a..a69c3b6 100644 --- a/app/src/main/res/layout/activity_edit_profile.xml +++ b/app/src/main/res/layout/activity_edit_profile.xml @@ -4,6 +4,138 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/background_color" + android:orientation="vertical" tools:context=".screens.account.EditProfileActivity"> + + + + + + + + + + + + + + + + + + + +