Commit e0558838 authored by RAHUL SHARMA's avatar RAHUL SHARMA

Changes in BroadActivityFragment

parent cfae4dc0
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<Objective-C-extensions> <codeStyleSettings language="XML">
<file> <arrangement>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> <rules>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> <section>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> <rule>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> <match>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> <AND>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> <NAME>xmlns:android</NAME>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> <XML_ATTRIBUTE />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> <XML_NAMESPACE>^$</XML_NAMESPACE>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> </AND>
</file> </match>
<class> </rule>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> </section>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> <section>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> <rule>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> <match>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> <AND>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> <NAME>xmlns:.*</NAME>
</class> <XML_ATTRIBUTE />
<extensions> <XML_NAMESPACE>^$</XML_NAMESPACE>
<pair source="cpp" header="h" fileNamingConvention="NONE" /> </AND>
<pair source="c" header="h" fileNamingConvention="NONE" /> </match>
</extensions> <order>BY_NAME</order>
</Objective-C-extensions> </rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme> </code_scheme>
</component> </component>
\ No newline at end of file
...@@ -71,5 +71,14 @@ dependencies { ...@@ -71,5 +71,14 @@ dependencies {
implementation "com.jakewharton.threetenabp:threetenabp:${threetenBPVersion}" implementation "com.jakewharton.threetenabp:threetenabp:${threetenBPVersion}"
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.browser:browser:1.0.0' implementation 'androidx.browser:browser:1.0.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
{ {
"project_info": { "project_info": {
"project_number": "259853447628", "project_number": "1023141785699",
"firebase_url": "https://astral-theory-207617.firebaseio.com", "firebase_url": "https://insticonnect-45378.firebaseio.com",
"project_id": "astral-theory-207617", "project_id": "insticonnect-45378",
"storage_bucket": "astral-theory-207617.appspot.com" "storage_bucket": "insticonnect-45378.appspot.com"
}, },
"client": [ "client": [
{ {
"client_info": { "client_info": {
"mobilesdk_app_id": "1:259853447628:android:efaea50ea28ccfec", "mobilesdk_app_id": "1:1023141785699:android:58573214b1f96c0f5a8856",
"android_client_info": { "android_client_info": {
"package_name": "app.insti" "package_name": "app.insti"
} }
}, },
"oauth_client": [ "oauth_client": [
{ {
"client_id": "259853447628-be3teletcqtfpfddj9qnk0bqj221h2mo.apps.googleusercontent.com", "client_id": "1023141785699-28upmbifpbs6un76kdr3hpm6fug7n9v4.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "app.insti",
"certificate_hash": "06e2d90cd8194ec68c63a02bcfba1eacc0c6708e"
}
},
{
"client_id": "1023141785699-vu4a8rsf0idtik4389hsgdo2g7tp4m8q.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "app.insti",
"certificate_hash": "21f9683560ab885f4047ada091134c1e42b090a8"
}
},
{
"client_id": "1023141785699-pruslo8ehct8hfkusat4s1et7m21noek.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
} }
], ],
"api_key": [ "api_key": [
{ {
"current_key": "AIzaSyB8B7N-3hnW_u4jOXHLRUzbMl6To3aDyJo" "current_key": "AIzaSyBZaFkdmkZ3A9enFnXBttS6iWGbh597yyo"
} }
], ],
"services": { "services": {
"analytics_service": {
"status": 1
},
"appinvite_service": { "appinvite_service": {
"status": 1, "other_platform_oauth_client": [
"other_platform_oauth_client": [] {
}, "client_id": "1023141785699-pruslo8ehct8hfkusat4s1et7m21noek.apps.googleusercontent.com",
"ads_service": { "client_type": 3
"status": 2 }
]
} }
} }
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera" />
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<receiver android:name=".widget.MessMenuWidget"> <receiver android:name=".widget.MessMenuWidget">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
......
...@@ -8,14 +8,19 @@ import android.net.Uri; ...@@ -8,14 +8,19 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.FirebaseApp;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId; import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult; import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.storage.FirebaseStorage;
import app.insti.Constants; import app.insti.Constants;
import app.insti.R; import app.insti.R;
...@@ -48,6 +53,7 @@ public class LoginActivity extends AppCompatActivity { ...@@ -48,6 +53,7 @@ public class LoginActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
session = new SessionManager(mContext); session = new SessionManager(mContext);
if (session.isLoggedIn()) { if (session.isLoggedIn()) {
openMainActivity(); openMainActivity();
} else { } else {
......
...@@ -61,6 +61,7 @@ import app.insti.api.model.Role; ...@@ -61,6 +61,7 @@ import app.insti.api.model.Role;
import app.insti.api.model.User; import app.insti.api.model.User;
import app.insti.api.request.UserFCMPatchRequest; import app.insti.api.request.UserFCMPatchRequest;
import app.insti.fragment.BackHandledFragment; import app.insti.fragment.BackHandledFragment;
import app.insti.fragment.BroadActivityFragment;
import app.insti.fragment.CalendarFragment; import app.insti.fragment.CalendarFragment;
import app.insti.fragment.ComplaintsFragment; import app.insti.fragment.ComplaintsFragment;
import app.insti.fragment.ExploreFragment; import app.insti.fragment.ExploreFragment;
...@@ -555,6 +556,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -555,6 +556,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
updateFragment(new NewsFragment()); updateFragment(new NewsFragment());
break; break;
case R.id.nav_broad_activities:
updateFragment(new BroadActivityFragment());
break;
case R.id.nav_placement_blog: case R.id.nav_placement_blog:
openPlacementBlog(); openPlacementBlog();
break; break;
......
package app.insti.adapter; package app.insti.adapter;
public class ActivitiesAdapter { import android.app.Activity;
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.squareup.picasso.Picasso;
import java.util.List;
import app.insti.R;
import app.insti.api.model.BroadActivity;
public class ActivitiesAdapter extends RecyclerView.Adapter<ActivitiesAdapter.BroadActivitiesViewHolder> {
private Context context;
private List<BroadActivity> broadActivityList;
public ActivitiesAdapter(Context context,List<BroadActivity> broadActivityList){
this.context = context;
this.broadActivityList = broadActivityList;
}
@NonNull
@Override
public BroadActivitiesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.resource_layout_broad_activities,parent,false);
return new BroadActivitiesViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull BroadActivitiesViewHolder holder, int position) {
BroadActivity broadActivity = broadActivityList.get(position);
holder.txtView.setText(broadActivity.getBroadActivityName());
Picasso.get().load(broadActivity.getAvatarUrl()).fit().centerCrop().into(holder.imgView);
}
@Override
public int getItemCount() {
return broadActivityList.size();
}
public class BroadActivitiesViewHolder extends RecyclerView.ViewHolder {
ImageView imgView;
TextView txtView;
public BroadActivitiesViewHolder(@NonNull View itemView) {
super(itemView);
imgView = itemView.findViewById(R.id.imgViewActivity);
txtView = itemView.findViewById(R.id.txtViewActivity);
}
}
} }
package app.insti.api.model; package app.insti.api.model;
public class BroadActivity { import com.google.gson.annotations.SerializedName;
import java.util.List;
import app.insti.interfaces.CardInterface;
public class BroadActivity implements CardInterface {
@SerializedName("id")
private String broadActivityID;
@SerializedName("name")
private String broadActivityName;
@SerializedName("image_url")
private String broadActivityImageURL;
@SerializedName("children")
private List<SubActivity> broadActivityChildren;
public String getBroadActivityID() {
return broadActivityID;
}
public String getBroadActivityName() {
return broadActivityName;
}
public String getBroadActivityImageURL() {
return broadActivityImageURL;
}
public List<SubActivity> getBroadActivityChildren() {
return broadActivityChildren;
}
public void setBroadActivityID(String broadActivityID) {
this.broadActivityID = broadActivityID;
}
public void setBroadActivityName(String broadActivityName) {
this.broadActivityName = broadActivityName;
}
public void setBroadActivityImageURL(String broadActivityImageURL) {
this.broadActivityImageURL = broadActivityImageURL;
}
public void setBroadActivityChildren(List<SubActivity> broadActivityChildren) {
this.broadActivityChildren = broadActivityChildren;
}
@Override
public long getId() {
return getBroadActivityID().hashCode();
}
@Override
public String getTitle() {
return getBroadActivityName();
}
@Override
public String getSubtitle() {
return null;
}
@Override
public String getAvatarUrl() {
return getBroadActivityImageURL();
}
} }
package app.insti.api.model; package app.insti.api.model;
public class NewEvent { import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
import java.sql.Timestamp;
import java.util.List;
import app.insti.interfaces.CardInterface;
public class NewEvent implements CardInterface {
@NonNull()
@SerializedName("id")
private String newEventID;
@SerializedName("str_id")
private String newEventStrID;
@SerializedName("name")
private String newEventName;
@SerializedName("description")
private String newEventDescription;
@SerializedName("image_url")
private String newEventImageURL;
@SerializedName("date")
private Timestamp newEventDate;
@SerializedName("start_time")
private Timestamp newEventStartTime;
@SerializedName("end_time")
private Timestamp newEventEndTime;
@SerializedName("venue")
private String newEventVenue;
@SerializedName("parent")
private SubActivity newEventParent;
@SerializedName("interested_count")
private int newEventInterestedCount;
@SerializedName("going_count")
private int newEventGoingCount;
@SerializedName("interested")
private List<User> newEventInterested;
@SerializedName("going")
private List<User> newEventGoing;
@NonNull
public String getNewEventID() {
return newEventID;
}
public String getNewEventStrID() {
return newEventStrID;
}
public String getNewEventName() {
return newEventName;
}
public String getNewEventDescription() {
return newEventDescription;
}
public String getNewEventImageURL() {
return newEventImageURL;
}
public Timestamp getNewEventDate() {
return newEventDate;
}
public Timestamp getNewEventStartTime() {
return newEventStartTime;
}
public Timestamp getNewEventEndTime() {
return newEventEndTime;
}
public String getNewEventVenue() {
return newEventVenue;
}
public SubActivity getNewEventParent() {
return newEventParent;
}
public int getNewEventInterestedCount() {
return newEventInterestedCount;
}
public int getNewEventGoingCount() {
return newEventGoingCount;
}
public List<User> getNewEventInterested() {
return newEventInterested;
}
public List<User> getNewEventGoing() {
return newEventGoing;
}
public void setNewEventID(@NonNull String newEventID) {
this.newEventID = newEventID;
}
public void setNewEventStrID(String newEventStrID) {
this.newEventStrID = newEventStrID;
}
public void setNewEventName(String newEventName) {
this.newEventName = newEventName;
}
public void setNewEventDescription(String newEventDescription) {
this.newEventDescription = newEventDescription;
}
public void setNewEventImageURL(String newEventImageURL) {
this.newEventImageURL = newEventImageURL;
}
public void setNewEventDate(Timestamp newEventDate) {
this.newEventDate = newEventDate;
}
public void setNewEventStartTime(Timestamp newEventStartTime) {
this.newEventStartTime = newEventStartTime;
}
public void setNewEventEndTime(Timestamp newEventEndTime) {
this.newEventEndTime = newEventEndTime;
}
public void setNewEventVenue(String newEventVenue) {
this.newEventVenue = newEventVenue;
}
public void setNewEventParent(SubActivity newEventParent) {
this.newEventParent = newEventParent;
}
public void setNewEventInterestedCount(int newEventInterestedCount) {
this.newEventInterestedCount = newEventInterestedCount;
}
public void setNewEventGoingCount(int newEventGoingCount) {
this.newEventGoingCount = newEventGoingCount;
}
public void setNewEventInterested(List<User> newEventInterested) {
this.newEventInterested = newEventInterested;
}
public void setNewEventGoing(List<User> newEventGoing) {
this.newEventGoing = newEventGoing;
}
@Override
public long getId() {
return getNewEventID().hashCode();
}
@Override
public String getTitle() {
return getNewEventName();
}
@Override
public String getSubtitle() {
String subtitle = getNewEventDate() + "|" + getNewEventStartTime().toString() + "|" + getNewEventVenue();
return subtitle;
}
@Override
public String getAvatarUrl() {
return getNewEventImageURL();
}
} }
package app.insti.api.model; package app.insti.api.model;
public class SubActivity { import com.google.gson.annotations.SerializedName;
import java.util.List;
import app.insti.interfaces.CardInterface;
public class SubActivity implements CardInterface {
@SerializedName("id")
private String subActivityID;
@SerializedName("name")
private String subActivityName;
@SerializedName("image_url")
private String subActivityImageURL;
@SerializedName("shortdescription")
private String subActivityShortDescription;
@SerializedName("description")
private String subActivityDescription;
@SerializedName("parent")
private BroadActivity subActivityParents;
@SerializedName("children")
private List<NewEvent> subActivityChildren;
@SerializedName("followers_count")
private int subActivityFollowersCount;
@SerializedName("user_follows")
private boolean subActivityUserFollows;
public String getSubActivityID() {
return subActivityID;
}
public String getSubActivityName() {
return subActivityName;
}
public String getSubActivityImageURL() {
return subActivityImageURL;
}
public List<NewEvent> getSubActivityChildren() {
return subActivityChildren;
}
public BroadActivity getSubActivityParents() {
return subActivityParents;
}
public String getSubActivityShortDescription() {
return subActivityShortDescription;
}
public void setSubActivityID(String subActivityID) {
this.subActivityID = subActivityID;
}
public void setSubActivityName(String subActivityName) {
this.subActivityName = subActivityName;
}
public void setSubActivityImageURL(String subActivityImageURL) {
this.subActivityImageURL = subActivityImageURL;
}
public void setSubActivityChildren(List<NewEvent> subActivityChildren) {
this.subActivityChildren = subActivityChildren;
}
public void setSubActivityParents(BroadActivity subActivityParents) {
this.subActivityParents = subActivityParents;
}
public String getSubActivityDescription() {
return subActivityDescription;
}
public int getSubActivityFollowersCount() {
return subActivityFollowersCount;
}
public boolean isSubActivityUserFollows() {
return subActivityUserFollows;
}
public void setSubActivityDescription(String subActivityDescription) {
this.subActivityDescription = subActivityDescription;
}
public void setSubActivityFollowersCount(int subActivityFollowersCount) {
this.subActivityFollowersCount = subActivityFollowersCount;
}
public void setSubActivityUserFollows(boolean subActivityUserFollows) {
this.subActivityUserFollows = subActivityUserFollows;
}
public void setSubActivityShortDescription(String subActivityShortDescription) {
this.subActivityShortDescription = subActivityShortDescription;
}
@Override
public long getId() {
return getSubActivityID().hashCode();
}
@Override
public String getTitle() {
return getSubActivityName();
}
@Override
public String getSubtitle() {
return getSubActivityDescription() ;
}
@Override
public String getAvatarUrl() {
return getSubActivityImageURL();
}
} }
package app.insti; package app.insti.fragment;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.ArrayList;
import java.util.List;
import app.insti.R;
import app.insti.adapter.ActivitiesAdapter;
import app.insti.api.model.BroadActivity;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link BroadActivityFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link BroadActivityFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BroadActivityFragment extends Fragment { public class BroadActivityFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match // TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER // 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 StorageReference storageReference;
private String mParam1; private DatabaseReference databaseReference;
private String mParam2; private List<BroadActivity> broadActivityList;
private OnFragmentInteractionListener mListener;
public BroadActivityFragment() { public BroadActivityFragment() {
// Required empty public constructor // 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 BroadActivityFragment.
*/
// TODO: Rename and change types and number of parameters
public static BroadActivityFragment newInstance(String param1, String param2) {
BroadActivityFragment fragment = new BroadActivityFragment();
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 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_broad_activity, container, false);
return inflater.inflate(R.layout.fragment_broad_activity, container, false);
}
// TODO: Rename method, update argument and hook method into UI event RecyclerView broadActivitiesList = view.findViewById(R.id.broadActivitiesList);
public void onButtonPressed(Uri uri) { broadActivitiesList.setLayoutManager(new LinearLayoutManager(getContext()));
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
broadActivityList = new ArrayList<>();
databaseReference = FirebaseDatabase.getInstance().getReference("activities");
databaseReference.addValueEventListener(new ValueEventListener() {
@Override @Override
public void onAttach(Context context) { public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
super.onAttach(context); for(DataSnapshot activitySnapshot : dataSnapshot.getChildren()){
if (context instanceof OnFragmentInteractionListener) { BroadActivity broadActivity = activitySnapshot.getValue(BroadActivity.class);
mListener = (OnFragmentInteractionListener) context; broadActivityList.add(broadActivity);
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
} }
ActivitiesAdapter broadActivityAdapter = new ActivitiesAdapter(getContext(),broadActivityList);
broadActivitiesList.setAdapter(broadActivityAdapter);
} }
@Override @Override
public void onDetach() { public void onCancelled(@NonNull DatabaseError databaseError) {
super.onDetach(); Toast.makeText(getContext(),"Something wrong happened", Toast.LENGTH_SHORT).show();
mListener = null;
} }
});
/** return view;
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
} }
} }
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".BroadActivityFragment"> tools:context=".fragment.BroadActivityFragment">
<!-- TODO: Update blank fragment layout --> <!-- TODO: Update blank fragment layout -->
<TextView <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" /> android:id="@+id/broadActivitiesList">
</androidx.recyclerview.widget.RecyclerView>
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/txtViewActivity" android:id="@+id/txtViewActivity"
style="@style/TextAppearance.AppCompat.Title" style="@style/TextAppearance.AppCompat.Title"
android:layout_marginTop="10dp"> android:layout_marginTop="10dp"
android:textColor="@color/colorPrimary"
android:background="@color/colorAccent">
</TextView> </TextView>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="4dp"
android:paddingLeft="18dp"
android:paddingRight="10dp"
android:paddingTop="2dp"
android:minHeight="80dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imgViewSubActivity"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/txtViewSubActivityName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"
android:textColor="?attr/themeColorInverse"
android:textSize="17sp"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/txtViewSubActivityShortDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textSize="15sp"
android:textColor="?attr/themeGray" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
android:icon="@drawable/ic_search_black_24dp" android:icon="@drawable/ic_search_black_24dp"
android:title="Explore" /> android:title="Explore" />
<item
android:id="@+id/nav_broad_activities"
android:icon="@drawable/ic_dashboard_black_48dp"
android:title="Activities"/>
<item <item
android:id="@+id/nav_mess_menu" android:id="@+id/nav_mess_menu"
android:icon="@drawable/ic_restaurant_black_48dp" android:icon="@drawable/ic_restaurant_black_48dp"
......
...@@ -55,4 +55,7 @@ ...@@ -55,4 +55,7 @@
<string name="GPS_not_enables">GPS is not enabled!</string> <string name="GPS_not_enables">GPS is not enabled!</string>
<string name="no_permission">No permission!</string> <string name="no_permission">No permission!</string>
<string name="enter_location_details">Enter Location Details</string> <string name="enter_location_details">Enter Location Details</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>
...@@ -9,8 +9,9 @@ buildscript { ...@@ -9,8 +9,9 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.2.0' // classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
......
#Mon May 06 02:37:18 IST 2019 #Fri Nov 01 03:28:46 IST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment