());
32 |
33 | // Reduce current count
34 | ShortcutBadger.applyCount(context.getApplicationContext(), NotificationId.decrementAndGetCurrentCount());
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
22 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/adapter/ComplaintFragmentViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package app.insti.adapter;
2 |
3 | import androidx.annotation.Nullable;
4 | import androidx.fragment.app.Fragment;
5 | import androidx.fragment.app.FragmentManager;
6 | import androidx.fragment.app.FragmentStatePagerAdapter;
7 |
8 | import app.insti.fragment.ComplaintsHomeFragment;
9 | import app.insti.fragment.ComplaintsMeFragment;
10 |
11 | /**
12 | * Created by Shivam Sharma on 15-08-2018.
13 | */
14 |
15 | public class ComplaintFragmentViewPagerAdapter extends FragmentStatePagerAdapter {
16 |
17 | private String userID, sessionID, userProfileUrl;
18 |
19 | public ComplaintFragmentViewPagerAdapter(FragmentManager fm,String userID, String sessionID, String userProfileUrl) {
20 | super(fm);
21 | this.userID = userID;
22 | this.sessionID = sessionID;
23 | this.userProfileUrl = userProfileUrl;
24 | }
25 |
26 | @Override
27 | public Fragment getItem(int position) {
28 | switch (position) {
29 | case 0:
30 | return ComplaintsHomeFragment.getInstance(userID, userProfileUrl);
31 | case 1:
32 | return ComplaintsMeFragment.getInstance(userID, userProfileUrl);
33 | default:
34 | return ComplaintsHomeFragment.getInstance(userID, userProfileUrl);
35 | }
36 | }
37 |
38 | @Nullable
39 | @Override
40 | public CharSequence getPageTitle(int position) {
41 | if (position == 0) {
42 | return "Home";
43 | } else {
44 | return "Me";
45 | }
46 | }
47 |
48 | @Override
49 | public int getCount() {
50 | return 2;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/map_children_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
25 |
26 |
33 |
34 |
35 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/adapter/ComplaintDetailsPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package app.insti.adapter;
2 |
3 | import androidx.fragment.app.Fragment;
4 | import androidx.fragment.app.FragmentManager;
5 | import androidx.fragment.app.FragmentPagerAdapter;
6 |
7 | import app.insti.fragment.ComplaintDetailsFragment;
8 |
9 | /**
10 | * Created by Shivam Sharma on 19-09-2018.
11 | */
12 |
13 | public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
14 |
15 | private String complaintid, userid, userProfileUrl;
16 |
17 | public ComplaintDetailsPagerAdapter(FragmentManager fm, String complaintid, String userid, String userProfileUrl) {
18 | super(fm);
19 | this.complaintid = complaintid;
20 | this.userid = userid;
21 | this.userProfileUrl = userProfileUrl;
22 | }
23 |
24 | @Override
25 | public Fragment getItem(int position) {
26 | switch (position) {
27 | case 0:
28 | return ComplaintDetailsFragment.getInstance(complaintid, userid, userProfileUrl);
29 | /*
30 | For version 2:
31 | case 1:
32 | return RelevantComplaintsFragment.getInstance(sessionid, userid);
33 | */
34 | default:
35 | return ComplaintDetailsFragment.getInstance(complaintid, userid, userProfileUrl);
36 | }
37 | }
38 |
39 | @Override
40 | public CharSequence getPageTitle(int position) {
41 | if (position == 0) {
42 | return "Complaint Details";
43 | } else {
44 | return "Relevant Complaints";
45 | }
46 |
47 | }
48 |
49 | @Override
50 | public int getCount() {
51 | return 1;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
16 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrane/zoomview/ImageViewState.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2014 David Morrissey
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package com.mrane.zoomview;
18 |
19 | import android.graphics.PointF;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Wraps the scale, center and orientation of a displayed image for easy restoration on screen rotate.
25 | */
26 | public class ImageViewState implements Serializable {
27 |
28 | /**
29 | *
30 | */
31 | private static final long serialVersionUID = -4397017033346987595L;
32 |
33 | private float scale;
34 |
35 | private float centerX;
36 |
37 | private float centerY;
38 |
39 | private int orientation;
40 |
41 | public ImageViewState(float scale, PointF center, int orientation) {
42 | this.scale = scale;
43 | this.centerX = center.x;
44 | this.centerY = center.y;
45 | this.orientation = orientation;
46 | }
47 |
48 | public float getScale() {
49 | return scale;
50 | }
51 |
52 | public PointF getCenter() {
53 | return new PointF(centerX, centerY);
54 | }
55 |
56 | public int getOrientation() {
57 | return orientation;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_complaints_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
21 |
22 |
26 |
27 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/listview_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
40 |
41 |
42 | -
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package app.insti.fragment;
2 |
3 |
4 | import android.app.Activity;
5 | import android.content.Context;
6 |
7 | import androidx.fragment.app.Fragment;
8 |
9 | import app.insti.ActivityBuffer;
10 |
11 | /**
12 | * A simple {@link Fragment} subclass.
13 | */
14 | public class BaseFragment extends Fragment {
15 |
16 | /* Member Variables. */
17 | private ActivityBuffer mActivityBuffer;
18 |
19 | public BaseFragment() {
20 | // Implement the Parent.
21 | super();
22 | // Allocate the ActivityBuffer.
23 | this.mActivityBuffer = new ActivityBuffer();
24 | }
25 |
26 | @Override
27 | public final void onAttach(final Context pContext) {
28 | // Handle as usual.
29 | super.onAttach(pContext);
30 | // Is the Context an Activity?
31 | if (pContext instanceof Activity) {
32 | // Cast Accordingly.
33 | final Activity lActivity = (Activity) pContext;
34 | // Inform the ActivityBuffer.
35 | this.getActivityBuffer().onContextGained(lActivity);
36 | }
37 | }
38 |
39 | @Deprecated
40 | @Override
41 | public final void onAttach(final Activity pActivity) {
42 | // Handle as usual.
43 | super.onAttach(pActivity);
44 | // Inform the ActivityBuffer.
45 | this.getActivityBuffer().onContextGained(pActivity);
46 | }
47 |
48 | @Override
49 | public final void onDetach() {
50 | // Handle as usual.
51 | super.onDetach();
52 | // Inform the ActivityBuffer.
53 | this.getActivityBuffer().onContextLost();
54 | }
55 |
56 | /* Getters. */
57 | public final ActivityBuffer getActivityBuffer() {
58 | return this.mActivityBuffer;
59 | }
60 |
61 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/mess_menu_widget.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
16 |
17 |
22 |
23 |
30 |
31 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_mess_menu.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_explore.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
29 |
30 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/api/LocationAPIUtils.java:
--------------------------------------------------------------------------------
1 | package app.insti.api;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.android.gms.maps.CameraUpdateFactory;
6 | import com.google.android.gms.maps.GoogleMap;
7 | import com.google.android.gms.maps.MapView;
8 | import com.google.android.gms.maps.OnMapReadyCallback;
9 | import com.google.android.gms.maps.model.CameraPosition;
10 | import com.google.android.gms.maps.model.LatLng;
11 | import com.google.android.gms.maps.model.MarkerOptions;
12 |
13 | /**
14 | * Created by Shivam Sharma on 13-08-2018.
15 | *
16 | * This API updates the Google Map when the location is added.
17 | */
18 |
19 | public class LocationAPIUtils {
20 |
21 | private static final String TAG = LocationAPIUtils.class.getSimpleName();
22 | private GoogleMap googleMap;
23 | private MapView mMapView;
24 |
25 | public LocationAPIUtils(GoogleMap googleMap, MapView mMapView) {
26 | this.googleMap = googleMap;
27 | this.mMapView = mMapView;
28 | }
29 |
30 | public void callGoogleToShowLocationOnMap( final LatLng location, final String name, final String address, final int cursor) {
31 | mMapView.getMapAsync(new OnMapReadyCallback() {
32 |
33 | @Override
34 | public void onMapReady(GoogleMap mMap) {
35 | googleMap = mMap;
36 | if (cursor != 0) {
37 | googleMap.clear();
38 | }
39 | googleMap.addMarker(new MarkerOptions().position(location).title(name).snippet(address));
40 | CameraPosition cameraPosition = new CameraPosition.Builder().target(location).zoom(17).build();
41 | googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
42 | Log.i(TAG, "curser = " + cursor);
43 | }
44 | });
45 | }
46 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/map_expandable_list_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
29 |
30 |
38 |
39 |
43 |
44 |
48 |
49 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
17 |
18 |
25 |
26 |
31 |
32 |
37 |
38 |
43 |
44 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_complaints_me.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
23 |
24 |
28 |
29 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_complaint.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
18 |
19 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/ComplaintDescriptionAutoCompleteTextView.java:
--------------------------------------------------------------------------------
1 | package app.insti;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.ProgressBar;
9 |
10 | /**
11 | * Created by Shivam Sharma on 13-08-2018.
12 | */
13 |
14 | public class ComplaintDescriptionAutoCompleteTextView extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
15 |
16 | private static final int MESSAGE_TEXT_CHANGED = 100;
17 | private static final int DEFAULT_AUTOCOMPLETE_DELAY = 750;
18 |
19 | private int mAutoCompleteDelay = DEFAULT_AUTOCOMPLETE_DELAY;
20 | private ProgressBar mLoadingIndicator;
21 |
22 | private final Handler mHandler = new Handler() {
23 | @Override
24 | public void handleMessage(Message msg) {
25 | ComplaintDescriptionAutoCompleteTextView.super.performFiltering((CharSequence) msg.obj, msg.arg1);
26 | }
27 | };
28 |
29 | public ComplaintDescriptionAutoCompleteTextView(Context context, AttributeSet attrs) {
30 | super(context, attrs);
31 | }
32 |
33 | public void setLoadingIndicator(ProgressBar progressBar) {
34 | mLoadingIndicator = progressBar;
35 | }
36 |
37 | public void setAutoCompleteDelay(int autoCompleteDelay) {
38 | mAutoCompleteDelay = autoCompleteDelay;
39 | }
40 |
41 | @Override
42 | protected void performFiltering(CharSequence text, int keyCode) {
43 | if (mLoadingIndicator != null) {
44 | mLoadingIndicator.setVisibility(View.VISIBLE);
45 | }
46 | mHandler.removeMessages(MESSAGE_TEXT_CHANGED);
47 | mHandler.sendMessageDelayed(mHandler.obtainMessage(MESSAGE_TEXT_CHANGED, text), mAutoCompleteDelay);
48 | }
49 |
50 | @Override
51 | public void onFilterComplete(int count) {
52 | if (mLoadingIndicator != null) {
53 | mLoadingIndicator.setVisibility(View.GONE);
54 | }
55 | super.onFilterComplete(count);
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news_article_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
22 |
23 |
30 |
31 |
37 |
38 |
44 |
45 |
46 |
53 |
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | InstiApp
2 | ===============
3 | ### Powered by the Web and Coding Club, IIT Bombay
4 |
5 | All IITB content in one place. InstiApp is the result of WnCC's coordinated efforts to build an application that makes it easier to discover IITB content on the go.
6 | InstiApp features the Placement Blog, Upcoming Events and general information on every active club/body in the Institute
7 |
8 | [](https://insti.app/android)
9 | [](https://github.com/wncc/instiapp-android/actions)
10 | [](https://github.com/wncc/instiapp-android/blob/master/LICENSE.md)
11 | [](https://www.codacy.com/gh/wncc/instiapp-android?utm_source=github.com&utm_medium=referral&utm_content=wncc/instiapp-android&utm_campaign=Badge_Grade)
12 |
13 | ### Features:
14 | * Events Directory
15 | * News
16 | * Explore
17 | * Mess Menu
18 | * Placement Blog
19 | * Internship Blog
20 | * Calendar
21 | * Map
22 | * Quick Links
23 |
24 | A more detailed list of features can be found [here](https://docs.google.com/document/d/1L4wzuw88JrLyBt1DvnjavtAwhJkXgNSIxJG3yBsLwQ0/edit?usp=sharing).
25 |
26 | InstiApp is a community effort and we appreciate the help of everyone who wants to help improve the App.
27 |
28 | Check http://github.com/wncc for more information about all development activities under WnCC.
29 |
30 | Development
31 | -----------
32 |
33 | Read the [API Documentation](https://wncc.github.io/IITBapp/).
34 |
35 | See the [Frontend Design](https://drive.google.com/open?id=1YJRUvsyqR5QtfWYug_PoBJ08p-criCPo).
36 |
37 | ### Contributors
38 | See [list of contributors](https://github.com/wncc/InstiApp/graphs/contributors)
39 |
40 | Release
41 | -------
42 |
43 | Download the app from the [Play Store](https://play.google.com/store/apps/details?id=app.insti) or visit [insti.app](https://insti.app)
44 |
45 | ###### InstiApp, WnCC are not endorsed by IIT Bombay, the institute.
46 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/fragment/NewsFragment.java:
--------------------------------------------------------------------------------
1 | package app.insti.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import androidx.appcompat.widget.Toolbar;
9 | import androidx.fragment.app.Fragment;
10 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
11 |
12 | import java.util.List;
13 |
14 | import app.insti.R;
15 | import app.insti.Utils;
16 | import app.insti.adapter.NewsAdapter;
17 | import app.insti.api.RetrofitInterface;
18 | import app.insti.api.model.NewsArticle;
19 | import retrofit2.Call;
20 |
21 | /**
22 | * A simple {@link Fragment} subclass.
23 | */
24 | public class NewsFragment extends RecyclerViewFragment {
25 |
26 | public NewsFragment() {
27 | // Required empty public constructor
28 | }
29 |
30 |
31 | @Override
32 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
33 | Bundle savedInstanceState) {
34 | // Inflate the layout for this fragment
35 | return inflater.inflate(R.layout.fragment_news, container, false);
36 | }
37 |
38 | @Override
39 | public void onStart() {
40 | super.onStart();
41 |
42 | Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
43 | toolbar.setTitle("News");
44 | Utils.setSelectedMenuItem(getActivity(), R.id.nav_news);
45 |
46 | setHasOptionsMenu(true);
47 | updateData();
48 |
49 | postType = NewsArticle.class;
50 | adapterType = NewsAdapter.class;
51 | recyclerView = getActivity().findViewById(R.id.news_recycler_view);
52 | swipeRefreshLayout = getActivity().findViewById(R.id.news_swipe_refresh_layout);
53 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
54 | @Override
55 | public void onRefresh() {
56 | updateData();
57 | }
58 | });
59 | }
60 |
61 | @Override
62 | protected Call> getCall(RetrofitInterface retrofitInterface, String sessionIDHeader, int postCount) {
63 | return retrofitInterface.getNews(sessionIDHeader, postCount, 20, searchQuery);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/api/model/MessMenu.java:
--------------------------------------------------------------------------------
1 | package app.insti.api.model;
2 |
3 | import androidx.annotation.NonNull;
4 |
5 | import com.google.gson.annotations.SerializedName;
6 |
7 | public class MessMenu {
8 | @NonNull()
9 | @SerializedName("id")
10 | private String mealID;
11 |
12 | @SerializedName("day")
13 | private int day;
14 |
15 | @SerializedName("breakfast")
16 | private String breakfast;
17 |
18 | @SerializedName("lunch")
19 | private String lunch;
20 |
21 | @SerializedName("snacks")
22 | private String snacks;
23 |
24 | @SerializedName("dinner")
25 | private String dinner;
26 |
27 | @SerializedName("hostel")
28 | private String hostelID;
29 |
30 | public MessMenu(String mealID, int day, String breakfast, String lunch, String snacks, String dinner, String hostelID) {
31 | this.mealID = mealID;
32 | this.day = day;
33 | this.breakfast = breakfast;
34 | this.lunch = lunch;
35 | this.snacks = snacks;
36 | this.dinner = dinner;
37 | this.hostelID = hostelID;
38 | }
39 |
40 | public String getMealID() {
41 | return mealID;
42 | }
43 |
44 | public void setMealID(String mealID) {
45 | this.mealID = mealID;
46 | }
47 |
48 | public int getDay() {
49 | return day;
50 | }
51 |
52 | public void setDay(int day) {
53 | this.day = day;
54 | }
55 |
56 | public String getBreakfast() {
57 | return breakfast;
58 | }
59 |
60 | public void setBreakfast(String breakfast) {
61 | this.breakfast = breakfast;
62 | }
63 |
64 | public String getLunch() {
65 | return lunch;
66 | }
67 |
68 | public void setLunch(String lunch) {
69 | this.lunch = lunch;
70 | }
71 |
72 | public String getSnacks() {
73 | return snacks;
74 | }
75 |
76 | public void setSnacks(String snacks) {
77 | this.snacks = snacks;
78 | }
79 |
80 | public String getDinner() {
81 | return dinner;
82 | }
83 |
84 | public void setDinner(String dinner) {
85 | this.dinner = dinner;
86 | }
87 |
88 | public String getHostelID() {
89 | return hostelID;
90 | }
91 |
92 | public void setHostelID(String hostelID) {
93 | this.hostelID = hostelID;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/SessionManager.java:
--------------------------------------------------------------------------------
1 | package app.insti;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 | import android.content.SharedPreferences.Editor;
7 | import android.util.Log;
8 |
9 | import app.insti.activity.LoginActivity;
10 | import app.insti.api.model.User;
11 |
12 | public class SessionManager {
13 | public SharedPreferences pref;
14 | private Editor editor;
15 | private Context context;
16 | private final int PRIVATE_MODE = 0;
17 |
18 | public SessionManager(Context context) {
19 | this.context = context;
20 | pref = context.getSharedPreferences(Constants.PREF_NAME, PRIVATE_MODE);
21 | }
22 |
23 | public void checkLogin() {
24 | if (!this.isLoggedIn()) {
25 | Intent i = new Intent(context, LoginActivity.class);
26 | // Closing all the Activities
27 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
28 | // Add new Flag to start new Activity
29 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
30 | // Staring Login Activity
31 | context.startActivity(i);
32 | }
33 | }
34 |
35 | public void createLoginSession(String gcmId, User currentUser, String sessionID) {
36 | Log.d("SessionManager", "GcmId being stored");
37 | editor = pref.edit();
38 | editor.putBoolean(Constants.IS_LOGGED_IN, true);
39 | editor.putString(Constants.GCM_ID, gcmId);
40 | editor.putString(Constants.USER_ID, currentUser.getUserID());
41 | editor.putString(Constants.CURRENT_USER, currentUser.toString());
42 | editor.putString(Constants.SESSION_ID, sessionID);
43 | editor.commit();
44 | }
45 |
46 | public String getUserID() {
47 | return pref.getString(Constants.USER_ID, "");
48 | }
49 |
50 | public User getCurrentUser() {
51 | return User.fromString(pref.getString(Constants.CURRENT_USER, ""));
52 | }
53 |
54 | public String getSessionID() {
55 | return pref.getString(Constants.SESSION_ID, "");
56 | }
57 |
58 | public boolean isLoggedIn() {
59 | return pref.getBoolean(Constants.IS_LOGGED_IN, false);
60 | }
61 |
62 | public void logout() {
63 | editor = pref.edit();
64 | editor.clear().commit();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/api/model/TrainingBlogPost.java:
--------------------------------------------------------------------------------
1 | package app.insti.api.model;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 |
8 | import com.google.gson.annotations.SerializedName;
9 |
10 | import java.sql.Timestamp;
11 |
12 | import app.insti.interfaces.Clickable;
13 |
14 | import static app.insti.Utils.openWebURL;
15 |
16 | public class TrainingBlogPost implements Clickable {
17 | @NonNull()
18 | @SerializedName("id")
19 | private String postID;
20 |
21 | @SerializedName("link")
22 | private String link;
23 |
24 | @SerializedName("title")
25 | private String title;
26 |
27 | @SerializedName("content")
28 | private String content;
29 |
30 | @SerializedName("published")
31 | private Timestamp published;
32 |
33 | public TrainingBlogPost(String postID, String link, String title, String content, Timestamp published) {
34 | this.postID = postID;
35 | this.link = link;
36 | this.title = title;
37 | this.content = content;
38 | this.published = published;
39 | }
40 |
41 | public String getId() { return postID; }
42 |
43 | public String getPostID() {
44 | return postID;
45 | }
46 |
47 | public void setPostID(String postID) {
48 | this.postID = postID;
49 | }
50 |
51 | public String getLink() {
52 | return link;
53 | }
54 |
55 | public void setLink(String link) {
56 | this.link = link;
57 | }
58 |
59 | public String getTitle() {
60 | return title;
61 | }
62 |
63 | public void setTitle(String title) {
64 | this.title = title;
65 | }
66 |
67 | public String getContent() {
68 | return content;
69 | }
70 |
71 | public void setContent(String content) {
72 | this.content = content;
73 | }
74 |
75 | public Timestamp getPublished() {
76 | return published;
77 | }
78 |
79 | public void setPublished(Timestamp published) {
80 | this.published = published;
81 | }
82 |
83 | @Override
84 | public View.OnClickListener getOnClickListener(final Context context) {
85 | return new View.OnClickListener() {
86 | @Override
87 | public void onClick(View v) {
88 | openWebURL(context, link);
89 | }
90 | };
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/api/model/PlacementBlogPost.java:
--------------------------------------------------------------------------------
1 | package app.insti.api.model;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 |
8 | import com.google.gson.annotations.SerializedName;
9 |
10 | import java.sql.Timestamp;
11 |
12 | import app.insti.interfaces.Clickable;
13 |
14 | import static app.insti.Utils.openWebURL;
15 |
16 | public class PlacementBlogPost implements Clickable {
17 | @NonNull()
18 | @SerializedName("id")
19 | private String postID;
20 |
21 | @SerializedName("link")
22 | private String link;
23 |
24 | @SerializedName("title")
25 | private String title;
26 |
27 | @SerializedName("content")
28 | private String content;
29 |
30 | @SerializedName("published")
31 | private Timestamp published;
32 |
33 | public PlacementBlogPost(String postID, String link, String title, String content, Timestamp published) {
34 | this.postID = postID;
35 | this.link = link;
36 | this.title = title;
37 | this.content = content;
38 | this.published = published;
39 | }
40 |
41 | public String getId() { return postID; }
42 |
43 | public String getPostID() {
44 | return postID;
45 | }
46 |
47 | public void setPostID(String postID) {
48 | this.postID = postID;
49 | }
50 |
51 | public String getLink() {
52 | return link;
53 | }
54 |
55 | public void setLink(String link) {
56 | this.link = link;
57 | }
58 |
59 | public String getTitle() {
60 | return title;
61 | }
62 |
63 | public void setTitle(String title) {
64 | this.title = title;
65 | }
66 |
67 | public String getContent() {
68 | return content;
69 | }
70 |
71 | public void setContent(String content) {
72 | this.content = content;
73 | }
74 |
75 | public Timestamp getPublished() {
76 | return published;
77 | }
78 |
79 | public void setPublished(Timestamp published) {
80 | this.published = published;
81 | }
82 |
83 | @Override
84 | public View.OnClickListener getOnClickListener(final Context context) {
85 | return new View.OnClickListener() {
86 | @Override
87 | public void onClick(View v) {
88 | openWebURL(context, link);
89 | }
90 | };
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/fragment/TrainingBlogFragment.java:
--------------------------------------------------------------------------------
1 | package app.insti.fragment;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import androidx.appcompat.widget.Toolbar;
10 | import androidx.fragment.app.Fragment;
11 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
12 |
13 | import java.util.List;
14 |
15 | import app.insti.R;
16 | import app.insti.Utils;
17 | import app.insti.adapter.TrainingBlogAdapter;
18 | import app.insti.api.RetrofitInterface;
19 | import app.insti.api.model.TrainingBlogPost;
20 | import retrofit2.Call;
21 |
22 | /**
23 | * A simple {@link Fragment} subclass.
24 | */
25 | public class TrainingBlogFragment extends RecyclerViewFragment {
26 |
27 | public TrainingBlogFragment() {
28 | // Required empty public constructor
29 | }
30 |
31 |
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
34 | Bundle savedInstanceState) {
35 | // Inflate the layout for this fragment
36 | return inflater.inflate(R.layout.fragment_training_blog, container, false);
37 | }
38 |
39 | @Override
40 | public void onStart() {
41 | super.onStart();
42 |
43 | Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
44 | toolbar.setTitle("Internship Blog");
45 | Utils.setSelectedMenuItem(getActivity(), R.id.nav_training_blog);
46 |
47 | setHasOptionsMenu(true);
48 | updateData();
49 |
50 | postType = TrainingBlogPost.class;
51 | adapterType = TrainingBlogAdapter.class;
52 | recyclerView = getActivity().findViewById(R.id.training_feed_recycler_view);
53 | swipeRefreshLayout = getActivity().findViewById(R.id.training_feed_swipe_refresh_layout);
54 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
55 | @Override
56 | public void onRefresh() {
57 | updateData();
58 | }
59 | });
60 | }
61 |
62 | @Override
63 | protected Call> getCall(RetrofitInterface retrofitInterface, String sessionIDHeader, int postCount) {
64 | return retrofitInterface.getTrainingBlogFeed(sessionIDHeader, postCount, 20, searchQuery);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrane/data/Locations.java:
--------------------------------------------------------------------------------
1 | package com.mrane.data;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 |
7 | import app.insti.api.model.Venue;
8 |
9 | public class Locations {
10 | public HashMap data = new HashMap();
11 |
12 | public Locations(List venueList) {
13 | // Add locations
14 | for (Venue venue : venueList) {
15 | Marker marker;
16 |
17 | // Skip bad locations
18 | if (venue.getVenuePixelX() == 0 || venue.getVenueGroupId() == null) {
19 | continue;
20 | }
21 |
22 | // Set some things up
23 | if (venue.getVenueParentRelation() == null) {
24 | venue.setVenueParentRelation("");
25 | }
26 |
27 | if (venue.getVenueParentRelation() == null || venue.getVenueParentRelation().equals("")) {
28 | // Add children
29 | final List children = new ArrayList();
30 | for (Venue child : venueList) {
31 | if (child.getVenueParentId() != null && child.getVenueParentId().equals(venue.getVenueID())) {
32 | children.add(child.getVenueName());
33 | }
34 | }
35 | String[] childArray = new String[children.size()];
36 |
37 | marker = new Building(
38 | venue.getVenueName(), venue.getVenueShortName(), venue.getVenuePixelX(), venue.getVenuePixelY(),
39 | venue.getVenueGroupId(), children.toArray(childArray), venue.getVenueDescripion());
40 | } else {
41 | // Get parent name
42 | String parentName = "";
43 | for (Venue parent : venueList) {
44 | if (parent.getVenueID().equals(venue.getVenueParentId())) {
45 | parentName = parent.getVenueName();
46 | break;
47 | }
48 | }
49 |
50 | marker = new Room(venue.getVenueName(), venue.getVenueShortName(), venue.getVenuePixelX(), venue.getVenuePixelY(),
51 | venue.getVenueGroupId(), parentName, venue.getVenueParentRelation(), venue.getVenueDescripion());
52 | }
53 | data.put(marker.getName(), marker);
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/fragment/PlacementBlogFragment.java:
--------------------------------------------------------------------------------
1 | package app.insti.fragment;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import androidx.appcompat.widget.Toolbar;
10 | import androidx.fragment.app.Fragment;
11 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
12 |
13 | import java.util.List;
14 |
15 | import app.insti.R;
16 | import app.insti.Utils;
17 | import app.insti.adapter.PlacementBlogAdapter;
18 | import app.insti.api.RetrofitInterface;
19 | import app.insti.api.model.PlacementBlogPost;
20 | import retrofit2.Call;
21 |
22 | /**
23 | * A simple {@link Fragment} subclass.
24 | */
25 | public class PlacementBlogFragment extends RecyclerViewFragment {
26 |
27 | public PlacementBlogFragment() {
28 | // Required empty public constructor
29 | }
30 |
31 |
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
34 | Bundle savedInstanceState) {
35 | // Inflate the layout for this fragment
36 | return inflater.inflate(R.layout.fragment_placement_blog, container, false);
37 | }
38 |
39 | @Override
40 | public void onStart() {
41 | super.onStart();
42 |
43 | Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
44 | toolbar.setTitle("Placement Blog");
45 | Utils.setSelectedMenuItem(getActivity(), R.id.nav_placement_blog);
46 |
47 | setHasOptionsMenu(true);
48 | updateData();
49 |
50 | postType = PlacementBlogPost.class;
51 | adapterType = PlacementBlogAdapter.class;
52 | recyclerView = getActivity().findViewById(R.id.placement_feed_recycler_view);
53 | swipeRefreshLayout = getActivity().findViewById(R.id.placement_feed_swipe_refresh_layout);
54 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
55 | @Override
56 | public void onRefresh() {
57 | updateData();
58 | }
59 | });
60 | }
61 |
62 | @Override
63 | protected Call> getCall(RetrofitInterface retrofitInterface, String sessionIDHeader, int postCount) {
64 | return retrofitInterface.getPlacementBlogFeed(sessionIDHeader, postCount, 20, searchQuery);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
68 |
--------------------------------------------------------------------------------
/app/src/main/assets/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
68 |
69 |
70 |
71 |
72 |
73 |

74 |
InstiApp
75 |
76 |
77 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/adapter/ImageViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package app.insti.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 |
9 | import androidx.annotation.NonNull;
10 | import androidx.viewpager.widget.PagerAdapter;
11 |
12 | import com.squareup.picasso.Picasso;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import app.insti.R;
18 | import app.insti.api.model.Venter;
19 |
20 | /**
21 | * Created by Shivam Sharma on 25-09-2018.
22 | */
23 |
24 | public class ImageViewPagerAdapter extends PagerAdapter {
25 |
26 | private List images = new ArrayList<>();
27 | public Context context;
28 | public LayoutInflater inflater;
29 |
30 | public ImageViewPagerAdapter(Context context, List images)
31 | {
32 | this.context = context;
33 | this.images = images;
34 | inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
35 | }
36 |
37 | public ImageViewPagerAdapter(Context context, Venter.Complaint detailedComplaint)
38 | {
39 | this.context = context;
40 | inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
41 |
42 | for (String image: detailedComplaint.getImages()){
43 | images.add(image);
44 | }
45 | }
46 |
47 | @Override
48 | public int getCount() {
49 | if (images.size() == 0)
50 | return 1;
51 | else
52 | return images.size();
53 | }
54 |
55 | @Override
56 | public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
57 | return view.equals(o);
58 | }
59 |
60 | @Override
61 | public void destroyItem(ViewGroup container, int position, Object object) {
62 | container.removeView((View) object);
63 | }
64 |
65 | @Override
66 | public Object instantiateItem(ViewGroup view, int position)
67 | {
68 | View imageLayout = inflater.inflate(R.layout.slidingimages_layout, view, false);
69 | assert imageLayout != null;
70 | final ImageView imageView = imageLayout.findViewById(R.id.slidingImageView);
71 |
72 | if (images.size() != 0)
73 | Picasso.get().load(images.get(position)).into(imageView);
74 | else
75 | Picasso.get().load(R.drawable.baseline_photo_black_48).resize(500,500).into(imageView);
76 |
77 | view.addView(imageLayout, 0);
78 | return imageLayout;
79 | }
80 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/map_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
22 |
23 |
31 |
32 |
33 |
34 |
39 |
40 |
47 |
48 |
55 |
56 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/utils/DateTimeUtil.java:
--------------------------------------------------------------------------------
1 | package app.insti.utils;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.concurrent.TimeUnit;
7 |
8 | public class DateTimeUtil {
9 |
10 | public static String getDate(String dtStart) {
11 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'");
12 | try {
13 | Date date = format.parse(dtStart);
14 | Date now = new Date();
15 | long diff = System.currentTimeMillis() - date.getTime();
16 | long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime());
17 | long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime());
18 | long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime());
19 | if (seconds <= 0) {
20 | return "Now";
21 | } else if (seconds < 60 && seconds > 1) {
22 | return seconds + " seconds ago";
23 | } else if (minutes == 1) {
24 | return " 1 minute ago";
25 | } else if (minutes < 60 && minutes > 1) {
26 | return minutes + " minutes ago";
27 | } else if (hours == 1) {
28 | return "An hour ago";
29 | } else if (hours < 24 && hours > 1) {
30 | return hours + " hours ago";
31 | } else {
32 | long days = Math.round(diff / (24.0 * 60 * 60 * 1000));
33 | if (days == 0)
34 | return "Today";
35 | else if (days == 1)
36 | return "Yesterday";
37 | else if (days < 14)
38 | return days + " days ago";
39 | else if (days < 30)
40 | if ((int) (days / 7) == 1)
41 | return "A week ago";
42 | else
43 | return ((int) (days / 7)) + " weeks ago";
44 | else if (days < 365)
45 | if ((int) (days / 30) == 1)
46 | return ((int) (days / 30)) + " month ago";
47 | else
48 | return ((int) (days / 30)) + " months ago";
49 | else
50 | if ((int) (days / 365) == 1)
51 | return "A year ago";
52 | else
53 | return ((int) (days / 365)) + " years ago";
54 | }
55 | } catch (ParseException e) {
56 | e.printStackTrace();
57 | }
58 | return "";
59 | }
60 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | InstiApp
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 |
8 |
9 |
10 | - Hostel 1
11 | - Hostel 2
12 | - Hostel 3
13 | - Hostel 4
14 | - Hostel 5
15 | - Hostel 6
16 | - Hostel 7
17 | - Hostel 8
18 | - Hostel 9
19 | - Hostel 10
20 | - Hostel 11
21 | - Hostel 12
22 | - Hostel 13
23 | - Hostel 14
24 | - Hostel 15
25 | - Hostel 16
26 | - Tansa House
27 | - QIP
28 |
29 |
30 |
31 | - @string/calendar_yes
32 | - @string/calendar_no
33 | - @string/calendar_always_ask
34 |
35 |
36 |
37 | Yes
38 | No
39 | Always ask
40 |
41 | INSTIAPP_NOTIFS
42 |
43 |
44 | AIzaSyC0T4chZbdcKjLkgEts9YVonPFyP7ckMIE
45 | Take photo using Camera
46 | Choose from gallery
47 | Add Image
48 | Vent your issues now!
49 | Nobody taking care of your civic complaints? Be it garbage, water, potholes etc.
50 | Please check your Network Connectivity
51 | Enter Suggestions (if any)
52 | No complaints at the moment
53 | Please provide the complaint description before submitting
54 | Getting current location.
55 | GPS is not enabled!
56 | No permission!
57 | Enter Location Details
58 |
59 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/app/insti/api/model/NewsArticle.java:
--------------------------------------------------------------------------------
1 | package app.insti.api.model;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 |
8 | import com.google.gson.annotations.SerializedName;
9 |
10 | import java.sql.Timestamp;
11 |
12 | import app.insti.interfaces.Clickable;
13 |
14 | import static app.insti.Utils.openWebURL;
15 |
16 | public class NewsArticle implements Clickable {
17 | @NonNull()
18 | @SerializedName("id")
19 | private String articleID;
20 |
21 | @SerializedName("link")
22 | private String link;
23 |
24 | @SerializedName("title")
25 | private String title;
26 |
27 | @SerializedName("content")
28 | private String content;
29 |
30 | @SerializedName("published")
31 | private Timestamp published;
32 |
33 | @SerializedName("body")
34 | private Body body;
35 |
36 | public NewsArticle(String articleID, String link, String title, String content, Timestamp published, Body body) {
37 | this.articleID = articleID;
38 | this.link = link;
39 | this.title = title;
40 | this.content = content;
41 | this.published = published;
42 | this.body = body;
43 | }
44 |
45 | public String getId() { return articleID; }
46 |
47 | public String getArticleID() {
48 | return articleID;
49 | }
50 |
51 | public void setArticleID(String articleID) {
52 | this.articleID = articleID;
53 | }
54 |
55 | public String getLink() {
56 | return link;
57 | }
58 |
59 | public void setLink(String link) {
60 | this.link = link;
61 | }
62 |
63 | public String getTitle() {
64 | return title;
65 | }
66 |
67 | public void setTitle(String title) {
68 | this.title = title;
69 | }
70 |
71 | public String getContent() {
72 | return content;
73 | }
74 |
75 | public void setContent(String content) {
76 | this.content = content;
77 | }
78 |
79 | public Timestamp getPublished() {
80 | return published;
81 | }
82 |
83 | public void setPublished(Timestamp published) {
84 | this.published = published;
85 | }
86 |
87 | public Body getBody() {
88 | return body;
89 | }
90 |
91 | public void setBody(Body body) {
92 | this.body = body;
93 | }
94 |
95 | @Override
96 | public View.OnClickListener getOnClickListener(final Context context) {
97 | return new View.OnClickListener() {
98 | @Override
99 | public void onClick(View v) {
100 | openWebURL(context, link);
101 | }
102 | };
103 | }
104 | }
105 |
--------------------------------------------------------------------------------