Commit 6b94b5ed authored by Varun Patil's avatar Varun Patil

Reduce technical debt (3)

parent 1cfcc606
...@@ -67,26 +67,8 @@ public class User implements CardInterface { ...@@ -67,26 +67,8 @@ public class User implements CardInterface {
private String currentRole; private String currentRole;
public User(@NonNull String userID, String userName, String userProfilePictureUrl, List<Event> userInterestedEvents, List<Event> userGoingEvents, String userEmail, String userRollNumber, String userContactNumber, Boolean showContactNumber, String userAbout, List<Body> userFollowedBodies, List<String> userFollowedBodiesID, List<Role> userRoles, List<Role> userInstituteRoles, List<Role> userFormerRoles, String userWebsiteURL, String userLDAPId, String hostel, String currentRole) { public User(@NonNull String userID) {
this.userID = userID; this.userID = userID;
this.userName = userName;
this.userProfilePictureUrl = userProfilePictureUrl;
this.userInterestedEvents = userInterestedEvents;
this.userGoingEvents = userGoingEvents;
this.userEmail = userEmail;
this.userRollNumber = userRollNumber;
this.userContactNumber = userContactNumber;
this.showContactNumber = showContactNumber;
this.userAbout = userAbout;
this.userFollowedBodies = userFollowedBodies;
this.userFollowedBodiesID = userFollowedBodiesID;
this.userRoles = userRoles;
this.userInstituteRoles = userInstituteRoles;
this.userFormerRoles = userFormerRoles;
this.userWebsiteURL = userWebsiteURL;
this.userLDAPId = userLDAPId;
this.hostel = hostel;
this.currentRole = currentRole;
} }
public static User fromString(String json) { public static User fromString(String json) {
......
...@@ -27,7 +27,7 @@ import app.insti.api.model.Body; ...@@ -27,7 +27,7 @@ import app.insti.api.model.Body;
* create an instance of this fragment. * create an instance of this fragment.
*/ */
public class BodyRecyclerViewFragment extends Fragment implements TransitionTargetFragment, TransitionTargetChild { public class BodyRecyclerViewFragment extends Fragment implements TransitionTargetFragment, TransitionTargetChild {
private static final String TAG = "BodyRecyclerViewFragment"; public static final String TAG = "BodyRecyclerViewFragment";
public Fragment parentFragment = null; public Fragment parentFragment = null;
private RecyclerView recyclerView; private RecyclerView recyclerView;
......
...@@ -65,14 +65,10 @@ import ru.noties.markwon.Markwon; ...@@ -65,14 +65,10 @@ import ru.noties.markwon.Markwon;
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class EventFragment extends BackHandledFragment implements TransitionTargetFragment { public class EventFragment extends BackHandledFragment implements TransitionTargetFragment {
Event event; private Event event;
Button goingButton; private Button goingButton;
Button interestedButton; private Button interestedButton;
ImageButton navigateButton; public String TAG = "EventFragment";
ImageButton webEventButton;
ImageButton shareEventButton;
RecyclerView bodyRecyclerView;
String TAG = "EventFragment";
private int appBarOffset = 0; private int appBarOffset = 0;
private boolean creatingView = false; private boolean creatingView = false;
...@@ -198,14 +194,14 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -198,14 +194,14 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
private void inflateViews(final Event event) { private void inflateViews(final Event event) {
eventPicture = (ImageView) getActivity().findViewById(R.id.event_picture_2); eventPicture = (ImageView) getActivity().findViewById(R.id.event_picture_2);
TextView eventTitle = (TextView) getActivity().findViewById(R.id.event_page_title); final TextView eventTitle = (TextView) getActivity().findViewById(R.id.event_page_title);
TextView eventDate = (TextView) getActivity().findViewById(R.id.event_page_date); final TextView eventDate = (TextView) getActivity().findViewById(R.id.event_page_date);
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description); final TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description);
goingButton = getActivity().findViewById(R.id.going_button); goingButton = getActivity().findViewById(R.id.going_button);
interestedButton = getActivity().findViewById(R.id.interested_button); interestedButton = getActivity().findViewById(R.id.interested_button);
navigateButton = getActivity().findViewById(R.id.navigate_button); final ImageButton navigateButton = getActivity().findViewById(R.id.navigate_button);
webEventButton = getActivity().findViewById(R.id.web_event_button); final ImageButton webEventButton = getActivity().findViewById(R.id.web_event_button);
shareEventButton = getActivity().findViewById(R.id.share_event_button); final ImageButton shareEventButton = getActivity().findViewById(R.id.share_event_button);
if (event.isEventBigImage() || !creatingView) { if (event.isEventBigImage() || !creatingView) {
Picasso.get().load(event.getEventImageURL()).into(eventPicture); Picasso.get().load(event.getEventImageURL()).into(eventPicture);
...@@ -221,7 +217,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -221,7 +217,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
SimpleDateFormat simpleDateFormatTime = new SimpleDateFormat("HH:mm"); SimpleDateFormat simpleDateFormatTime = new SimpleDateFormat("HH:mm");
final List<Body> bodyList = event.getEventBodies(); final List<Body> bodyList = event.getEventBodies();
bodyRecyclerView = (RecyclerView) getActivity().findViewById(R.id.body_card_recycler_view); final RecyclerView bodyRecyclerView = getActivity().findViewById(R.id.body_card_recycler_view);
BodyAdapter bodyAdapter = new BodyAdapter(bodyList, this); BodyAdapter bodyAdapter = new BodyAdapter(bodyList, this);
bodyRecyclerView.setAdapter(bodyAdapter); bodyRecyclerView.setAdapter(bodyAdapter);
bodyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); bodyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
......
...@@ -41,7 +41,7 @@ import retrofit2.Response; ...@@ -41,7 +41,7 @@ import retrofit2.Response;
public class ExploreFragment extends Fragment { public class ExploreFragment extends Fragment {
private RecyclerView recyclerView; private RecyclerView recyclerView;
LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
private static List<Body> allBodies = new ArrayList<>(); private static List<Body> allBodies = new ArrayList<>();
private static List<Body> bodies = new ArrayList<>(); private static List<Body> bodies = new ArrayList<>();
......
...@@ -35,7 +35,7 @@ public class FeedFragment extends BaseFragment { ...@@ -35,7 +35,7 @@ public class FeedFragment extends BaseFragment {
private RecyclerView feedRecyclerView; private RecyclerView feedRecyclerView;
private SwipeRefreshLayout feedSwipeRefreshLayout; private SwipeRefreshLayout feedSwipeRefreshLayout;
private FloatingActionButton fab; private FloatingActionButton fab;
LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
private int index = -1, top = -1; private int index = -1, top = -1;
private FeedAdapter feedAdapter = null; private FeedAdapter feedAdapter = null;
......
...@@ -121,7 +121,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -121,7 +121,7 @@ public class MapFragment extends Fragment implements TextWatcher,
public TextView placeNameTextView; public TextView placeNameTextView;
public TextView placeSubHeadTextView; public TextView placeSubHeadTextView;
public EditText editText; public EditText editText;
public HashMap<String, com.mrane.data.Marker> data; public HashMap<String, Marker> data;
public FragmentTransaction transaction; public FragmentTransaction transaction;
public CampusMapView campusMapView; public CampusMapView campusMapView;
public ImageButton addMarkerIcon; public ImageButton addMarkerIcon;
...@@ -134,7 +134,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -134,7 +134,7 @@ public class MapFragment extends Fragment implements TextWatcher,
private ListFragment listFragment; private ListFragment listFragment;
private Fragment fragment; private Fragment fragment;
private RelativeLayout fragmentContainer; private RelativeLayout fragmentContainer;
private List<com.mrane.data.Marker> markerlist; private List<Marker> markerlist;
private SlidingUpPanelLayout slidingLayout; private SlidingUpPanelLayout slidingLayout;
private CardSlideListener cardSlideListener; private CardSlideListener cardSlideListener;
private boolean noFragments = true; private boolean noFragments = true;
...@@ -269,7 +269,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -269,7 +269,7 @@ public class MapFragment extends Fragment implements TextWatcher,
if (getView() == null || getActivity() == null) return; if (getView() == null || getActivity() == null) return;
Locations mLocations = new Locations(venues); Locations mLocations = new Locations(venues);
data = mLocations.data; data = mLocations.data;
markerlist = new ArrayList<com.mrane.data.Marker>(data.values()); markerlist = new ArrayList<>(data.values());
if (getArguments() != null) { if (getArguments() != null) {
setupMap(getArguments().getString(Constants.MAP_INITIAL_MARKER)); setupMap(getArguments().getString(Constants.MAP_INITIAL_MARKER));
} }
...@@ -520,7 +520,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -520,7 +520,7 @@ public class MapFragment extends Fragment implements TextWatcher,
String key = editText.getText().toString(); String key = editText.getText().toString();
// get Marker object if exists // get Marker object if exists
com.mrane.data.Marker marker = data.get(key); Marker marker = data.get(key);
// display and zoom to marker if exists // display and zoom to marker if exists
if (marker != null) { if (marker != null) {
...@@ -535,17 +535,12 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -535,17 +535,12 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
private void showResultOnMap(String key) { private void showResultOnMap(String key) {
com.mrane.data.Marker marker = data.get(key); Marker marker = data.get(key);
showCard(marker); showCard(marker);
campusMapView.setAndShowResultMarker(marker); campusMapView.setAndShowResultMarker(marker);
} }
public void showCard() { public void showCard(Marker marker) {
com.mrane.data.Marker marker = campusMapView.getResultMarker();
showCard(marker);
}
public void showCard(com.mrane.data.Marker marker) {
String name = marker.getName(); String name = marker.getName();
if (!marker.getShortName().equals("0")) if (!marker.getShortName().equals("0"))
name = marker.getShortName(); name = marker.getShortName();
...@@ -561,7 +556,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -561,7 +556,7 @@ public class MapFragment extends Fragment implements TextWatcher,
cardSlideListener.showCard(); cardSlideListener.showCard();
} }
private void setImage(LinearLayout parent, com.mrane.data.Marker marker) { private void setImage(LinearLayout parent, Marker marker) {
View v = getLayoutInflater().inflate(R.layout.map_card_image, parent); View v = getLayoutInflater().inflate(R.layout.map_card_image, parent);
ImageView iv = (ImageView) v.findViewById(R.id.place_image); ImageView iv = (ImageView) v.findViewById(R.id.place_image);
int imageId = getResources().getIdentifier(marker.getImageUri(), int imageId = getResources().getIdentifier(marker.getImageUri(),
...@@ -569,7 +564,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -569,7 +564,7 @@ public class MapFragment extends Fragment implements TextWatcher,
iv.setImageResource(imageId); iv.setImageResource(imageId);
} }
private void addDescriptionView(com.mrane.data.Marker marker) { private void addDescriptionView(Marker marker) {
LinearLayout parent = (LinearLayout) getActivity().findViewById(R.id.other_details); LinearLayout parent = (LinearLayout) getActivity().findViewById(R.id.other_details);
parent.removeAllViews(); parent.removeAllViews();
if (!marker.getImageUri().isEmpty()) { if (!marker.getImageUri().isEmpty()) {
...@@ -655,7 +650,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -655,7 +650,7 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
private SpannableStringBuilder getDescriptionText(com.mrane.data.Marker marker) { private SpannableStringBuilder getDescriptionText(Marker marker) {
String text = marker.getDescription(); String text = marker.getDescription();
SpannableStringBuilder desc = new SpannableStringBuilder(text); SpannableStringBuilder desc = new SpannableStringBuilder(text);
String[] toBoldParts = {"Email", "Phone No.", "Fax No."}; String[] toBoldParts = {"Email", "Phone No.", "Fax No."};
...@@ -674,7 +669,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -674,7 +669,7 @@ public class MapFragment extends Fragment implements TextWatcher,
SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE); SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
private void setSubHeading(com.mrane.data.Marker marker) { private void setSubHeading(Marker marker) {
SpannableStringBuilder result = new SpannableStringBuilder(""); SpannableStringBuilder result = new SpannableStringBuilder("");
result.append(marker.getName()); result.append(marker.getName());
if (marker instanceof Room) { if (marker instanceof Room) {
...@@ -766,17 +761,17 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -766,17 +761,17 @@ public class MapFragment extends Fragment implements TextWatcher,
placeSubHeadTextView.setText(result); placeSubHeadTextView.setText(result);
} }
private Drawable getLockIcon(com.mrane.data.Marker marker) { private Drawable getLockIcon(Marker marker) {
int color = marker.getColor(); int color = marker.getColor();
int drawableId = R.drawable.lock_all_off; int drawableId = R.drawable.lock_all_off;
if (campusMapView.isAddedMarker(marker)) { if (campusMapView.isAddedMarker(marker)) {
if (color == com.mrane.data.Marker.COLOR_BLUE) if (color == Marker.COLOR_BLUE)
drawableId = R.drawable.lock_blue_on; drawableId = R.drawable.lock_blue_on;
else if (color == com.mrane.data.Marker.COLOR_YELLOW) else if (color == Marker.COLOR_YELLOW)
drawableId = R.drawable.lock_on_yellow; drawableId = R.drawable.lock_on_yellow;
else if (color == com.mrane.data.Marker.COLOR_GREEN) else if (color == Marker.COLOR_GREEN)
drawableId = R.drawable.lock_green_on; drawableId = R.drawable.lock_green_on;
else if (color == com.mrane.data.Marker.COLOR_GRAY) else if (color == Marker.COLOR_GRAY)
drawableId = R.drawable.lock_gray_on; drawableId = R.drawable.lock_gray_on;
} }
Drawable lock = getResources().getDrawable(drawableId); Drawable lock = getResources().getDrawable(drawableId);
...@@ -788,11 +783,11 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -788,11 +783,11 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
private void reCenterMarker() { private void reCenterMarker() {
com.mrane.data.Marker marker = campusMapView.getResultMarker(); Marker marker = campusMapView.getResultMarker();
reCenterMarker(marker); reCenterMarker(marker);
} }
private void reCenterMarker(com.mrane.data.Marker marker) { private void reCenterMarker(Marker marker) {
PointF p = marker.getPoint(); PointF p = marker.getPoint();
float shift = getResources().getDimension(R.dimen.expanded_card_height) / 2.0f; float shift = getResources().getDimension(R.dimen.expanded_card_height) / 2.0f;
PointF center = new PointF(p.x, p.y + shift); PointF center = new PointF(p.x, p.y + shift);
...@@ -847,7 +842,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -847,7 +842,7 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
private void setOldText() { private void setOldText() {
com.mrane.data.Marker oldMarker = campusMapView.getResultMarker(); Marker oldMarker = campusMapView.getResultMarker();
if (oldMarker == null) { if (oldMarker == null) {
if (editText.length() > 0) { if (editText.length() > 0) {
editText.getText().clear(); editText.getText().clear();
...@@ -928,7 +923,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -928,7 +923,7 @@ public class MapFragment extends Fragment implements TextWatcher,
setAddMarkerIcon(campusMapView.getResultMarker()); setAddMarkerIcon(campusMapView.getResultMarker());
} }
private void setAddMarkerIcon(com.mrane.data.Marker m) { private void setAddMarkerIcon(Marker m) {
addMarkerIcon.setImageDrawable(getLockIcon(m)); addMarkerIcon.setImageDrawable(getLockIcon(m));
} }
......
...@@ -25,7 +25,7 @@ import retrofit2.Response; ...@@ -25,7 +25,7 @@ import retrofit2.Response;
public class SettingsFragment extends PreferenceFragmentCompat { public class SettingsFragment extends PreferenceFragmentCompat {
private SharedPreferences.Editor editor; private SharedPreferences.Editor editor;
SwitchPreferenceCompat showContactPref; private SwitchPreferenceCompat showContactPref;
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
......
...@@ -17,7 +17,6 @@ import app.insti.fragment.MapFragment; ...@@ -17,7 +17,6 @@ import app.insti.fragment.MapFragment;
public class ListFragment extends Fragment { public class ListFragment extends Fragment {
MapFragment mainActivity; MapFragment mainActivity;
FuzzySearchAdapter adapter;
View rootView; View rootView;
ListView list; ListView list;
...@@ -28,7 +27,7 @@ public class ListFragment extends Fragment { ...@@ -28,7 +27,7 @@ public class ListFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
mainActivity = MapFragment.getMainActivity(); mainActivity = MapFragment.getMainActivity();
adapter = mainActivity.getAdapter(); final FuzzySearchAdapter adapter = mainActivity.getAdapter();
rootView = inflater.inflate(R.layout.map_list_fragment, container, false); rootView = inflater.inflate(R.layout.map_list_fragment, container, false);
list = (ListView) rootView.findViewById(R.id.suggestion_list); list = (ListView) rootView.findViewById(R.id.suggestion_list);
list.setAdapter(adapter); list.setAdapter(adapter);
......
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