Commit 05aa16dd authored by Sajal Narang's avatar Sajal Narang Committed by GitHub

Merge pull request #166 from pulsejet/patch-5

Patch 5
parents efd3ca90 f54afa7d
...@@ -472,6 +472,20 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -472,6 +472,20 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return false; return false;
} }
public boolean editBodyAccess(Body toEditBody) {
if (currentUser == null || currentUser.getUserRoles() == null || currentUser.getUserRoles().size() == 0)
return false;
for (Role role : currentUser.getUserRoles()) {
for (Body body : role.getRoleBodies()) {
if (body.getBodyID().equals(toEditBody.getBodyID())) {
return true;
}
}
}
return false;
}
public static void hideKeyboard(Activity activity) { public static void hideKeyboard(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it. //Find the currently focused view, so we can grab the correct window token from it.
......
...@@ -48,7 +48,11 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { ...@@ -48,7 +48,11 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
User user = userList.get(position); User user = userList.get(position);
holder.userName.setText(user.getUserName()); holder.userName.setText(user.getUserName());
if (user.getCurrentRole() == null || user.getCurrentRole().equals("")) {
holder.role.setText(user.getUserLDAPId());
} else {
holder.role.setText(user.getCurrentRole()); holder.role.setText(user.getCurrentRole());
}
Picasso.get() Picasso.get()
.load(user.getUserProfilePictureUrl()) .load(user.getUserProfilePictureUrl())
.resize(150, 0) .resize(150, 0)
......
...@@ -29,6 +29,7 @@ import app.insti.MainActivity; ...@@ -29,6 +29,7 @@ import app.insti.MainActivity;
import app.insti.R; import app.insti.R;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
import app.insti.api.ServiceGenerator; import app.insti.api.ServiceGenerator;
import app.insti.data.Body;
import app.insti.data.Event; import app.insti.data.Event;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
...@@ -89,6 +90,9 @@ public class AddEventFragment extends BaseFragment { ...@@ -89,6 +90,9 @@ public class AddEventFragment extends BaseFragment {
String url = "https://" + host + "/add-event?sandbox=true"; String url = "https://" + host + "/add-event?sandbox=true";
if (getArguments().containsKey("id")) { if (getArguments().containsKey("id")) {
url = "https://" + host + "/edit-event/" + getArguments().getString("id") + "?sandbox=true"; url = "https://" + host + "/edit-event/" + getArguments().getString("id") + "?sandbox=true";
} else if (getArguments().containsKey("bodyId")) {
url = "https://" + host + "/edit-body/" + getArguments().getString("bodyId") + "?sandbox=true";
toolbar.setTitle("Update Organization");
} }
webView.loadUrl(url); webView.loadUrl(url);
...@@ -144,6 +148,23 @@ public class AddEventFragment extends BaseFragment { ...@@ -144,6 +148,23 @@ public class AddEventFragment extends BaseFragment {
public void onFailure(Call<Event> call, Throwable t) { } public void onFailure(Call<Event> call, Throwable t) { }
}); });
return true;
} else if (url.contains("/org/")) {
url = url.substring(url.lastIndexOf("/") + 1);
RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
retrofitInterface.getBody(((MainActivity) getActivity()).getSessionIDHeader(), url).enqueue(new Callback<Body>() {
@Override
public void onResponse(Call<Body> call, Response<Body> response) {
if (response.isSuccessful()) {
openBody(response.body());
}
}
@Override
public void onFailure(Call<Body> call, Throwable t) { }
});
return true; return true;
} }
// return true; //Indicates WebView to NOT load the url; // return true; //Indicates WebView to NOT load the url;
...@@ -201,6 +222,15 @@ public class AddEventFragment extends BaseFragment { ...@@ -201,6 +222,15 @@ public class AddEventFragment extends BaseFragment {
transaction.addToBackStack(eventFragment.getTag()).commit(); transaction.addToBackStack(eventFragment.getTag()).commit();
} }
void openBody(Body body) {
BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
transaction.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag());
transaction.addToBackStack(bodyFragment.getTag()).commit();
}
public void onActivityResult(int requestCode, int resultCode, Intent data){ public void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == 101) { if (requestCode == 101) {
if (uploadMessage == null) return; if (uploadMessage == null) return;
......
...@@ -12,8 +12,10 @@ import android.graphics.Rect; ...@@ -12,8 +12,10 @@ import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.NestedScrollView;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -85,7 +87,7 @@ public class BodyFragment extends BackHandledFragment { ...@@ -85,7 +87,7 @@ public class BodyFragment extends BackHandledFragment {
private float startScaleFinal; private float startScaleFinal;
private ImageView bodyPicture; private ImageView bodyPicture;
private Body body; private Body body;
private boolean bodyDisplayed = false;
public BodyFragment() { public BodyFragment() {
// Required empty public constructor // Required empty public constructor
...@@ -134,6 +136,9 @@ public class BodyFragment extends BackHandledFragment { ...@@ -134,6 +136,9 @@ public class BodyFragment extends BackHandledFragment {
body = min_body; body = min_body;
displayBody(); displayBody();
new getDbBody().execute(min_body.getBodyID()); new getDbBody().execute(min_body.getBodyID());
updateBody();
bodySwipeRefreshLayout = getActivity().findViewById(R.id.body_swipe_refresh_layout); bodySwipeRefreshLayout = getActivity().findViewById(R.id.body_swipe_refresh_layout);
bodySwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { bodySwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override @Override
...@@ -156,8 +161,11 @@ public class BodyFragment extends BackHandledFragment { ...@@ -156,8 +161,11 @@ public class BodyFragment extends BackHandledFragment {
new updateDbBody().execute(bodyResponse); new updateDbBody().execute(bodyResponse);
if (!bodyDisplayed) {
body = bodyResponse; body = bodyResponse;
displayBody(); displayBody();
}
if (bodySwipeRefreshLayout.isRefreshing())
bodySwipeRefreshLayout.setRefreshing(false); bodySwipeRefreshLayout.setRefreshing(false);
} }
} }
...@@ -180,7 +188,8 @@ public class BodyFragment extends BackHandledFragment { ...@@ -180,7 +188,8 @@ public class BodyFragment extends BackHandledFragment {
private void displayBody() { private void displayBody() {
/* Skip if we're already destroyed */ /* Skip if we're already destroyed */
if (getView() == null) return; if (getActivity() == null || getView() == null) return;
if(!body.equals(min_body)) bodyDisplayed = true;
TextView bodyName = (TextView) getView().findViewById(R.id.body_name); TextView bodyName = (TextView) getView().findViewById(R.id.body_name);
TextView bodyDescription = (TextView) getView().findViewById(R.id.body_description); TextView bodyDescription = (TextView) getView().findViewById(R.id.body_description);
...@@ -345,6 +354,31 @@ public class BodyFragment extends BackHandledFragment { ...@@ -345,6 +354,31 @@ public class BodyFragment extends BackHandledFragment {
childrenRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); childrenRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE); getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
/* Show update button if role */
if (((MainActivity) getActivity()).editBodyAccess(body)) {
final FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.edit_fab);
fab.setVisibility(View.VISIBLE);
NestedScrollView nsv = (NestedScrollView) getView().findViewById(R.id.body_scrollview);
nsv.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY > oldScrollY) fab.hide();
else fab.show();
}
});
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment();
Bundle bundle = new Bundle();
bundle.putString("bodyId", body.getBodyID());
addEventFragment.setArguments(bundle);
((MainActivity) getActivity()).updateFragment(addEventFragment);
}
});
}
} }
/** /**
...@@ -389,11 +423,9 @@ public class BodyFragment extends BackHandledFragment { ...@@ -389,11 +423,9 @@ public class BodyFragment extends BackHandledFragment {
@Override @Override
protected void onPostExecute(Body[] result) { protected void onPostExecute(Body[] result) {
if (result.length > 0) { if (result.length > 0 && !bodyDisplayed) {
body = result[0]; body = result[0];
displayBody(); displayBody();
} else {
updateBody();
} }
} }
} }
......
...@@ -187,6 +187,9 @@ public class EventFragment extends BackHandledFragment { ...@@ -187,6 +187,9 @@ public class EventFragment extends BackHandledFragment {
setFollowButtonColors(event.getEventUserUes()); setFollowButtonColors(event.getEventUserUes());
if (event.getEventVenues().get(0).getVenueLatitude() == 0) {
navigateButton.setVisibility(View.GONE);
} else {
navigateButton.setOnClickListener(new View.OnClickListener() { navigateButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -197,6 +200,7 @@ public class EventFragment extends BackHandledFragment { ...@@ -197,6 +200,7 @@ public class EventFragment extends BackHandledFragment {
startActivity(mapIntent); startActivity(mapIntent);
} }
}); });
}
shareEventButton.setOnClickListener(new View.OnClickListener() { shareEventButton.setOnClickListener(new View.OnClickListener() {
String shareUrl = ShareURLMaker.getEventURL(event); String shareUrl = ShareURLMaker.getEventURL(event);
......
...@@ -69,7 +69,6 @@ import com.google.android.gms.tasks.OnCompleteListener; ...@@ -69,7 +69,6 @@ import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Task;
import com.mrane.campusmap.ExpandableListAdapter; import com.mrane.campusmap.ExpandableListAdapter;
import com.mrane.campusmap.FuzzySearchAdapter; import com.mrane.campusmap.FuzzySearchAdapter;
import com.mrane.campusmap.IndexFragment;
import com.mrane.campusmap.ListFragment; import com.mrane.campusmap.ListFragment;
import com.mrane.campusmap.SettingsManager; import com.mrane.campusmap.SettingsManager;
import com.mrane.data.Building; import com.mrane.data.Building;
...@@ -110,7 +109,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -110,7 +109,6 @@ public class MapFragment extends Fragment implements TextWatcher,
private ExpandableListAdapter expAdapter; private ExpandableListAdapter expAdapter;
private FragmentManager fragmentManager; private FragmentManager fragmentManager;
private ListFragment listFragment; private ListFragment listFragment;
private IndexFragment indexFragment;
private Fragment fragment; private Fragment fragment;
public LinearLayout newSmallCard; public LinearLayout newSmallCard;
public ImageView placeColor; public ImageView placeColor;
...@@ -123,9 +121,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -123,9 +121,6 @@ public class MapFragment extends Fragment implements TextWatcher,
private List<com.mrane.data.Marker> markerlist; private List<com.mrane.data.Marker> markerlist;
public FragmentTransaction transaction; public FragmentTransaction transaction;
public CampusMapView campusMapView; public CampusMapView campusMapView;
public ImageButton removeIcon;
public ImageButton indexIcon;
public ImageButton mapIcon;
public ImageButton addMarkerIcon; public ImageButton addMarkerIcon;
private DrawerLayout mDrawerLayout; private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle; private ActionBarDrawerToggle mDrawerToggle;
...@@ -256,7 +251,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -256,7 +251,6 @@ public class MapFragment extends Fragment implements TextWatcher,
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<com.mrane.data.Marker>(data.values());
setUpDrawer();
setupMap(); setupMap();
// Setup locate button // Setup locate button
...@@ -320,32 +314,10 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -320,32 +314,10 @@ public class MapFragment extends Fragment implements TextWatcher,
campusMapView.setSettingsManager(settingsManager); campusMapView.setSettingsManager(settingsManager);
campusMapView.setData(data); campusMapView.setData(data);
removeIcon = (ImageButton) getActivity().findViewById(R.id.remove_icon);
removeIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
removeClick(v);
}
});
indexIcon = (ImageButton) getActivity().findViewById(R.id.index_icon);
indexIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
indexClick(v);
}
});
mapIcon = (ImageButton) getActivity().findViewById(R.id.map_icon);
mapIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapClick(v);
}
});
addMarkerIcon = (ImageButton) getActivity().findViewById(R.id.add_marker_icon); addMarkerIcon = (ImageButton) getActivity().findViewById(R.id.add_marker_icon);
fragmentManager = getChildFragmentManager(); fragmentManager = getChildFragmentManager();
listFragment = new ListFragment(); listFragment = new ListFragment();
indexFragment = new IndexFragment();
adapter.setSettingsManager(settingsManager); adapter.setSettingsManager(settingsManager);
...@@ -362,41 +334,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -362,41 +334,6 @@ public class MapFragment extends Fragment implements TextWatcher,
getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE); getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
} }
private void setUpDrawer() {
Toolbar mToolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
actionBarView = getActivity().findViewById(R.id.toolbar);
mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(getActivity(),
mDrawerLayout,
mToolbar,
R.string.drawer_open,
R.string.drawer_close) {
TextView settingsTitle = (TextView) getActivity().findViewById(R.id.settings_title);
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
settingsTitle.setVisibility(View.GONE);
editText.setVisibility(View.VISIBLE);
setCorrectIcons();
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
editText.setVisibility(View.GONE);
indexIcon.setVisibility(View.GONE);
mapIcon.setVisibility(View.GONE);
removeIcon.setVisibility(View.GONE);
settingsTitle.setVisibility(View.VISIBLE);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -454,15 +391,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -454,15 +391,6 @@ public class MapFragment extends Fragment implements TextWatcher,
if (placeSubHeadTextView != null) { if (placeSubHeadTextView != null) {
placeSubHeadTextView.setTypeface(regular); placeSubHeadTextView.setTypeface(regular);
} }
if (editText != null) {
editText.setTypeface(regular);
}
TextView settingsTitle = (TextView) getActivity()
.findViewById(R.id.settings_title);
if (settingsTitle != null) {
settingsTitle.setTypeface(regular);
}
} }
private Runnable setAnchor() { private Runnable setAnchor() {
...@@ -958,22 +886,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -958,22 +886,6 @@ public class MapFragment extends Fragment implements TextWatcher,
campusMapView.invalidate(); campusMapView.invalidate();
} }
public void removeClick(View v) {
this.editText.setText("");
displayMap();
}
public void indexClick(View v) {
this.putFragment(indexFragment);
this.removeEditTextFocus(null);
this.setCorrectIcons();
}
public void mapClick(View v) {
this.backToMap();
this.removeEditTextFocus("");
}
private void removeEditTextFocus(String text) { private void removeEditTextFocus(String text) {
if (this.editTextFocused) { if (this.editTextFocused) {
this.hideKeyboard(); this.hideKeyboard();
...@@ -1009,45 +921,28 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -1009,45 +921,28 @@ public class MapFragment extends Fragment implements TextWatcher,
if (noFragments) { if (noFragments) {
if (this.handleRemoveIcon()) { if (this.handleRemoveIcon()) {
this.noIndexButton(); this.noIndexButton();
} else {
this.setVisibleButton(indexIcon);
} }
} else { } else {
if (fragment instanceof ListFragment) { if (fragment instanceof ListFragment) {
if (this.handleRemoveIcon()) { if (this.handleRemoveIcon()) {
this.noIndexButton(); this.noIndexButton();
} else {
this.setVisibleButton(indexIcon);
} }
} else if (fragment instanceof IndexFragment) {
this.setVisibleButton(mapIcon);
} }
} }
} }
private void noIndexButton() { private void noIndexButton() {
indexIcon.setVisibility(View.GONE);
mapIcon.setVisibility(View.GONE);
} }
private boolean handleRemoveIcon() { private boolean handleRemoveIcon() {
String text = editText.getText().toString(); String text = editText.getText().toString();
if (text.isEmpty() || text.equals(null)) { if (text.isEmpty() || text.equals(null)) {
removeIcon.setVisibility(View.GONE);
return false; return false;
} else { } else {
removeIcon.setVisibility(View.VISIBLE);
return true; return true;
} }
} }
private void setVisibleButton(ImageButton icon) {
indexIcon.setVisibility(View.GONE);
mapIcon.setVisibility(View.GONE);
icon.setVisibility(View.VISIBLE);
}
@Override @Override
public void onFocusChange(View v, boolean focus) { public void onFocusChange(View v, boolean focus) {
this.editTextFocused = focus; this.editTextFocused = focus;
......
package com.mrane.campusmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnGroupClickListener;
import android.widget.ExpandableListView.OnGroupCollapseListener;
import android.widget.ExpandableListView.OnGroupExpandListener;
import com.mrane.data.Marker;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import app.insti.R;
import app.insti.fragment.MapFragment;
public class IndexFragment extends Fragment implements OnGroupExpandListener,
OnGroupCollapseListener, OnGroupClickListener {
MapFragment mainActivity;
ExpandableListAdapter adapter;
HashMap<String, Marker> data;
View rootView;
ExpandableListView list;
List<String> headers = new ArrayList<String>();
HashMap<String, List<String>> childData = new HashMap<String, List<String>>();
int pos;
int prevGroup = -1;
public IndexFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mainActivity = MapFragment.getMainActivity();
data = mainActivity.data;
if (headers.isEmpty()) {
setHeaderAndChildData();
}
adapter = new ExpandableListAdapter(mainActivity.getContext(), headers, childData);
rootView = inflater.inflate(R.layout.map_index_fragment, container, false);
list = (ExpandableListView) rootView.findViewById(R.id.index_list);
mainActivity.setExpAdapter(adapter);
list.setAdapter(adapter);
list.setOnChildClickListener(mainActivity);
list.setOnGroupExpandListener(this);
list.setOnGroupCollapseListener(this);
list.setOnGroupClickListener(this);
return rootView;
}
@Override
public void onResume() {
String name = mainActivity.editText.getText().toString();
if(name.isEmpty()) {
collapseAllGroups();
list.setSelectedGroup(0);
} else {
if(data.containsKey(name)) {
String groupName = data.get(name).getGroupName();
int groupId = getGroupId(groupName);
if(groupId != -1) {
list.expandGroup(groupId);
list.setSelectedGroup(groupId);
}
}
}
super.onResume();
}
private int getGroupId(String groupName) {
int groupCount = adapter.getGroupCount();
int temp = -1;
for (int i=0; i < groupCount; i++) {
if(adapter.getGroup(i).equals(groupName)) {
temp = i;
}
}
return temp;
}
private void collapseAllGroups() {
int groupCount = adapter.getGroupCount();
for (int i=0; i < groupCount; i++) {
list.collapseGroup(i);
}
}
private void setChildData() {
Collection<Marker> keys = data.values();
for (Marker key : keys) {
List<String> child = childData.get(key.getGroupName());
child.add(key.getName());
}
sortChildData();
}
private void sortChildData() {
for (String header : headers) {
List<String> child = childData.get(header);
Collections.sort(child);
}
}
private void setHeaderAndChildData() {
String[] headerString = Marker.getGroupNames();
Collections.addAll(headers, headerString);
for (String header : headers) {
childData.put(header, new ArrayList<String>());
}
setChildData();
}
@Override
public void onGroupExpand(int groupPosition) {
if (prevGroup != -1 && prevGroup != groupPosition) {
list.collapseGroup(prevGroup);
}
prevGroup = groupPosition;
}
@Override
public void onGroupCollapse(int groupPosition) {
if (prevGroup != -1) {
//list.setSelectionFromTop(prevGroup, 0);
}
}
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition,
long id) {
// Implement this method to scroll to the correct position as this doesn't
// happen automatically if we override onGroupExpand() as above
parent.smoothScrollToPosition(groupPosition);
// Need default behaviour here otherwise group does not get expanded/collapsed
// on click
if (parent.isGroupExpanded(groupPosition)) {
parent.collapseGroup(groupPosition);
} else {
parent.expandGroup(groupPosition);
}
return true;
}
}
...@@ -8,12 +8,17 @@ ...@@ -8,12 +8,17 @@
android:orientation="vertical" android:orientation="vertical"
tools:context=".fragment.BodyFragment"> tools:context=".fragment.BodyFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/body_swipe_refresh_layout" android:id="@+id/body_swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:id="@+id/body_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
...@@ -202,8 +207,22 @@ ...@@ -202,8 +207,22 @@
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/edit_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
android:src="@drawable/ic_edit_black_24dp"
android:tint="@android:color/black"
android:visibility="gone"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/loadingPanel" android:id="@+id/loadingPanel"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -213,7 +232,8 @@ ...@@ -213,7 +232,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
<app.insti.TouchImageView <app.insti.TouchImageView
......
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -12,20 +12,18 @@ ...@@ -12,20 +12,18 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.design.widget.TextInputLayout <EditText
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/explore_search" android:id="@+id/explore_search"
android:background="@color/colorPrimary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6dp" android:paddingLeft="18dp"
android:layout_marginRight="6dp" android:paddingRight="6dp"
android:layout_marginTop="3dp" android:paddingTop="3dp"
android:hint="Search" /> android:paddingBottom="15dp"
</android.support.design.widget.TextInputLayout> android:hint="Search"
android:textColor="@color/primaryTextColor"
android:textColorHint="@color/primaryTextColor"/>
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -70,7 +68,8 @@ ...@@ -70,7 +68,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -10,83 +10,19 @@ ...@@ -10,83 +10,19 @@
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary">
<EditText <EditText
android:id="@+id/search" android:id="@+id/search"
android:layout_width="fill_parent" android:background="@color/colorPrimary"
android:layout_height="48dp" android:layout_width="match_parent"
android:layout_alignParentLeft="true" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:paddingLeft="18dp"
android:background="@null" android:paddingRight="6dp"
android:dropDownHeight="0dp" android:paddingTop="3dp"
android:fontFamily="sans-serif" android:paddingBottom="15dp"
android:hint="Search" android:hint="Search"
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
android:paddingBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="50dp"
android:paddingTop="8dp"
android:selectAllOnFocus="true"
android:singleLine="true"
android:textColor="@color/primaryTextColor" android:textColor="@color/primaryTextColor"
android:textColorHint="@color/primaryTextColor"/> android:textColorHint="@color/primaryTextColor"/>
<TextView
android:id="@+id/settings_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:fontFamily="sans-serif-light"
android:paddingLeft="8dp"
android:paddingRight="76dp"
android:text="Settings"
android:visibility="gone" />
<ImageButton
android:id="@+id/index_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:contentDescription="index"
android:cropToPadding="true"
android:padding="12dp"
android:scaleType="fitXY"
android:src="@drawable/dept_menu" />
<ImageButton
android:id="@+id/map_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:contentDescription="map"
android:cropToPadding="true"
android:padding="12dp"
android:scaleType="fitXY"
android:src="@drawable/dept_menu_off"
android:visibility="gone" />
<ImageButton
android:id="@+id/remove_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:contentDescription="remove"
android:padding="8dp"
android:src="@drawable/ic_action_remove"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -148,7 +84,8 @@ ...@@ -148,7 +84,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</FrameLayout> </FrameLayout>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
...@@ -104,7 +104,8 @@ ...@@ -104,7 +104,8 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
<app.insti.TouchImageView <app.insti.TouchImageView
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<ProgressBar <ProgressBar
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
android:theme="@style/BlueAccent"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="BlueAccent">
<item name="colorAccent">@color/colorPrimary</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
......
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