Skip to content

Commit

Permalink
shhh (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin authored Jan 21, 2019
1 parent c6c7e7f commit e4e61f2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
31 changes: 29 additions & 2 deletions app/src/main/java/com/asuc/asucmobile/fragments/MapsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.SharedPreferences;
import android.content.pm.PackageManager;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.icu.text.SimpleDateFormat;
import android.icu.util.TimeZone;
Expand Down Expand Up @@ -41,6 +42,7 @@
import com.asuc.asucmobile.R;
import com.asuc.asucmobile.controllers.Controller;
import com.asuc.asucmobile.controllers.LiveBusController;
import com.asuc.asucmobile.main.CreditsDialog;
import com.asuc.asucmobile.main.LiveBusActivity;
import com.asuc.asucmobile.main.PopUpActivity;
import com.asuc.asucmobile.main.RouteSelectActivity;
Expand Down Expand Up @@ -110,6 +112,8 @@ public class MapsFragment extends Fragment
private GoogleMap mMap;
Gson gson = new Gson();
final LatLng BERKELEY = new LatLng(37.8716, -122.2727);
final LatLng EGG = new LatLng(37.8266,-122.3236);
final String GO_BEARS = "go bears!";
private GoogleApiClient googleApiClient;
double longitude;
double latitude;
Expand Down Expand Up @@ -382,7 +386,6 @@ public void onClick(View v) {
}
});


/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
Expand Down Expand Up @@ -518,6 +521,10 @@ public void onMapClick(LatLng latLng) {
bmService.callIconList().enqueue(new retrofit2.Callback<MapIconResponse>() {
@Override
public void onResponse(Call<MapIconResponse> call, Response<MapIconResponse> response) {

if (response.body() == null)
return;

mapHash.put("Microwave", response.body().getMicrowaves());
mapHash.put("Water Fountain", response.body().getWaterFountains());
mapHash.put("Nap Pod", response.body().getNapPods());
Expand All @@ -534,6 +541,8 @@ public void onFailure(Call<MapIconResponse> call, Throwable t) {


liveTrack();
shh();

}

private void updateLocation(View v) {
Expand Down Expand Up @@ -561,11 +570,19 @@ private void updateLocation(View v) {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public boolean onMarkerClick(final Marker marker) {

Log.d("HELLOOO", "MARKER CLICKED");

if (marker.getTag() == null) {
return true; //If the live busIcon is selected, dont' do anything.
}

// shhh
if (marker.getTitle().equals(GO_BEARS)) {
Intent i = new Intent(getActivity(), CreditsDialog.class);
startActivity(i);
return true;
}

Intent popUp;
clearFocus();
//marker.setIcon(icon);
Expand Down Expand Up @@ -608,7 +625,7 @@ private void loadMarkers(HashMap<String, ArrayList<CategoryLoc>> items) {
ArrayList<CategoryLoc> sleepPods = items.get("Nap Pod");
BitmapDescriptor microwaveIcon = BitmapDescriptorFactory.fromResource(R.drawable.microwave_map_icon);
BitmapDescriptor waterBottleIcon = BitmapDescriptorFactory.fromResource(R.drawable.waterbottle_map_icon);
BitmapDescriptor sleepPodIcon =BitmapDescriptorFactory.fromResource(R.drawable.sleeppod_map_icon);
BitmapDescriptor sleepPodIcon = BitmapDescriptorFactory.fromResource(R.drawable.sleeppod_map_icon);

if (microwaves != null && microwaves.size() != 0) {
for (CategoryLoc loc : microwaves) {
Expand Down Expand Up @@ -662,7 +679,17 @@ private void loadMarkers(HashMap<String, ArrayList<CategoryLoc>> items) {
}
}

}

private void shh() {
BitmapDescriptor bearIcon = BitmapDescriptorFactory.fromResource(R.drawable.bearmarker);
MarkerOptions singleMarkerOption = new MarkerOptions()
.position(EGG)
.icon(bearIcon)
.visible(true)
.title(GO_BEARS);
Marker singleMarker = mMap.addMarker(singleMarkerOption);
singleMarker.setTag(false);
}

public String getDistance(double lat, double lng) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void onResponse(Call<Buses> call, Response<Buses> response) {
failCount = 0;
}

if (response.body() == null)
return;

List<Bus> buses = LiveBusController.parse(response.body());
HashSet<String> lines = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ public static void openMenu(@NonNull final Activity activity) {
DrawerLayout drawerLayout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);
if (drawerLayout != null) {
drawerLayout.openDrawer(Gravity.LEFT);
View v = drawerLayout.findViewById(R.id.drawer_header);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(activity, CreditsDialog.class);
activity.startActivity(i);
}
});
}
}

Expand Down
15 changes: 4 additions & 11 deletions app/src/main/res/layout/credits_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,35 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Michael Eliot"
android:text="Rustie Lin"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="normal" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Alex Thomas"
android:text="Sid Karia"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="normal"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rustie Lin"
android:text="Yiling Kao"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="normal"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Siddharth Karia"
android:text="Derrick Li"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="normal"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sudarshan Gopalakrishnan"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="normal"/>

<ImageView
android:id="@+id/imageView2"
Expand Down

0 comments on commit e4e61f2

Please sign in to comment.