Пример #1
0
  // Sends user to Twitter with implicit Intent
  public void sendTwitter(View view) {

    Uri link = Uri.parse("https://twitter.com/" + receivedVenue.getTwitter());

    Intent twIntent = new Intent(Intent.ACTION_VIEW, link);
    startActivity(twIntent);
  }
Пример #2
0
  // Sends user to Facebook with implicit Intent
  public void sendFacebook(View view) {

    Uri link = Uri.parse("https://www.facebook.com/" + receivedVenue.getFb());

    Intent fbIntent = new Intent(Intent.ACTION_VIEW, link);
    startActivity(fbIntent);
  }
  private void reload() {
    UltimateFestivalOrganizerSoap ufo = UFOService.getInstance();

    venues = ufo.getAllVenues().getVenue();
    artists = ufo.getAllButDeletedArtists().getArtist();

    // Performances
    performances.clear();

    if (performancesSessionBean.getSelectedDate() == null) {
      return;
    }

    // fill with new
    for (Venue v : venues) {
      performances.put(v.getId(), new HashMap<>());

      for (int hour = 14; hour <= 23; ++hour) {
        Performance p = new Performance();
        p.setVenue(v);

        Calendar c = new GregorianCalendar();
        c.setTime(performancesSessionBean.getSelectedDate());
        c.add(Calendar.HOUR_OF_DAY, hour);
        p.setDateTime(dateToGregorian(c.getTime()));

        Artist a = new Artist();
        a.setId(0);
        p.setArtist(a);

        performances.get(v.getId()).put(hour, p);
      }
    }

    // fill with existing
    List<Performance> allPerformances =
        ufo.getPerformancesByDate(dateToGregorian(performancesSessionBean.getSelectedDate()))
            .getPerformance();
    for (Performance p : allPerformances) {
      int venueId = p.getVenue().getId();
      int hour = p.getDateTime().getHour();

      performances.get(venueId).put(hour, p);
    }
  }
Пример #4
0
  // Sends user to venue website with implicit Intent
  public void sendWebsite(View view) {

    // TextView websiteLink = (TextView) findViewById(R.id.venue_website);

    Uri link = Uri.parse(receivedVenue.getWeb());

    Intent webIntent = new Intent(Intent.ACTION_VIEW, link);
    startActivity(webIntent);
  }
Пример #5
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Section section = (Section) o;

    if (venue != null ? !venue.equals(section.venue) : section.venue != null) return false;
    if (name != null ? !name.equals(section.name) : section.name != null) return false;

    return true;
  }
Пример #6
0
  private int getVenueRating(Venue venue) {
    String url = "http://homepages.cs.ncl.ac.uk/d.ingram/TeamProject/getVenueAverage.php";
    // Set up connection
    String result = "";
    int resultInt = 0;
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost post = new HttpPost(url);
    Log.i("help", "point 1");
    try {
      // Add data to ArrayList
      List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
      urlParameters.add(new BasicNameValuePair("ID", Integer.toString(venue.getId())));
      post.setEntity(new UrlEncodedFormEntity(urlParameters));

      Log.i("help", "point 2");
      // Get the response from HTTP Server
      HttpResponse response = httpclient.execute(post);
      Log.i("help", "point 3");
      HttpEntity entity = response.getEntity();
      Log.i("help", "point 4");

      if (entity != null) {
        // Store response in InputStream
        InputStream is = entity.getContent();

        // Reads the input and encodes using IS0-8859-1 encoding.
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);

        // Covert InputStream to String
        String ans = null;
        StringBuilder sb = new StringBuilder();

        while ((ans = reader.readLine()) != null) {
          sb.append(ans);
        }
        result = sb.toString();
        Log.i("Result: ", result);
        JSONArray jsonResult = (JSONArray) new JSONParser().parse(result);
        JSONObject jsonObj = (JSONObject) jsonResult.get(0);
        String resultStr = (String) jsonObj.get("Average");
        Log.i("JSON Result: ", resultStr);
        resultInt = (int) (Math.round(Double.parseDouble(resultStr)));
        Log.i("Parsed int: ", Integer.toString(resultInt));
        return resultInt;
      }
    } catch (Exception e) {
      e.printStackTrace();
      Log.i("Fail", "Fail");
    }
    return resultInt;
  }
Пример #7
0
  private void fillInfo(Venue venue) {

    TextView venueName = (TextView) findViewById(R.id.venue_title);
    ImageView venueImage = (ImageView) findViewById(R.id.venue_img);
    TextView description = (TextView) findViewById(R.id.venue_desc);
    TextView address = (TextView) findViewById(R.id.venue_address);
    ImageView web = (ImageView) findViewById(R.id.venue_website);
    ImageView fb = (ImageView) findViewById(R.id.venue_fb_website);
    ImageView tw = (ImageView) findViewById(R.id.venue_tw_website);

    TextView entry = (TextView) findViewById(R.id.v_entry_fee);
    TextView discounts = (TextView) findViewById(R.id.v_discounts);
    TextView pre = (TextView) findViewById(R.id.v_prebar);
    TextView food = (TextView) findViewById(R.id.v_food);
    TextView lgbt = (TextView) findViewById(R.id.v_lgbt);

    RelativeLayout event1Layout = (RelativeLayout) findViewById(R.id.event1_layout);
    RelativeLayout event2Layout = (RelativeLayout) findViewById(R.id.event2_layout);
    RelativeLayout event3Layout = (RelativeLayout) findViewById(R.id.event3_layout);
    TextView eventShowMore = (TextView) findViewById(R.id.show_more_events);

    RelativeLayout review1Layout = (RelativeLayout) findViewById(R.id.review1_layout);
    RelativeLayout review2Layout = (RelativeLayout) findViewById(R.id.review2_layout);
    RelativeLayout review3Layout = (RelativeLayout) findViewById(R.id.review3_layout);
    TextView reviewShowMore = (TextView) findViewById(R.id.show_more_reviews);

    miscLayout = (LinearLayout) findViewById(R.id.v_expand_layout);
    miscPrompt = (TextView) findViewById(R.id.v_expand_prompt);

    TextView noReviews = (TextView) findViewById(R.id.no_reviews);
    TextView writeReview = (TextView) findViewById(R.id.write_review_prompt);
    TextView promptLogin = (TextView) findViewById(R.id.login_review_prompt);

    setTitle(venue.getName());
    venueName.setText(venue.getName());

    if (venue.getFilepath() != null) {
      Resources res = getResources();

      int resID = res.getIdentifier(venue.getFilepath(), "drawable", getPackageName());
      Drawable drawable = res.getDrawable(resID);

      venueImage.setImageDrawable(drawable);
    }

    description.setText(venue.getDesc());

    String s = "";
    if (venue.getAddress1() != null) {
      s += (venue.getAddress1() + "\n");
    }
    if (venue.getAddress2() != null) {
      s += (venue.getAddress2() + "\n");
    }
    if (venue.getAddress3() != null) {
      s += (venue.getAddress3() + "\n");
    }
    if (venue.getPostcode() != null) {
      s += venue.getPostcode();
    }

    address.setText(s);

    if (venue.getWeb() == null) {
      web.setVisibility(View.GONE);
    }
    if (venue.getFb() == null) {
      fb.setVisibility(View.GONE);
    }
    if (venue.getTwitter() == null) {
      tw.setVisibility(View.GONE);
    }

    if (venue.getEntry() > 0) {
      entry.setText("Entry: £" + venue.getEntry());
    } else {
      entry.setVisibility(View.GONE);
    }

    if (venue.isDiscounts() == true) discounts.setText("Discounts: Yes");
    else discounts.setText("Discounts: No");

    if (venue.isPreBar() == true) pre.setText("Pre-bar: Yes");
    else pre.setText("Pre-bar: No");

    if (venue.isFood() == true) food.setText("Serves food: Yes");
    else food.setText("Serves food: No");

    if (venue.isLgbt() == true) lgbt.setText("LGBT Venue: Yes");
    else lgbt.setText("LGBT Venue: No");

    event1Layout.setVisibility(View.GONE);
    event2Layout.setVisibility(View.GONE);
    event3Layout.setVisibility(View.GONE);
    eventShowMore.setVisibility(View.GONE);

    noReviews.setVisibility(View.VISIBLE);
    review1Layout.setVisibility(View.GONE);
    review2Layout.setVisibility(View.GONE);
    review3Layout.setVisibility(View.GONE);
    reviewShowMore.setVisibility(View.GONE);

    miscLayout.setVisibility(View.GONE);

    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    if (pref.getBoolean("Loggedin", false) != false) {
      promptLogin.setVisibility(View.GONE);
      writeReview.setVisibility(View.VISIBLE);
    } else {
      writeReview.setVisibility(View.GONE);
    }
  }
Пример #8
0
 @Override
 public int hashCode() {
   int result = name != null ? name.hashCode() : 0;
   result = 31 * result + (venue != null ? venue.hashCode() : 0);
   return result;
 }