Android Open Source - wristband-android Detail Activity






From Project

Back to project page wristband-android.

License

The source code is released under:

The Artistic License 2.0 Copyright (c) 2014 Allan Pichardo Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed...

If you think the Android project wristband-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nimo.wristband;
//from www.ja  v  a2 s. c o m
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
import com.google.android.gms.maps.model.Marker;
import com.nimo.wristband.fragments.WristbandMap;
import com.nimo.wristband.net.Show;

public class DetailActivity extends Activity implements OnMarkerClickListener{
  
  private Context context;
  private ActionBar actionBar;
  
  private WristbandMap map;
  private TextView summaryText;
  private Button bandcampButton;
  private Button songkickButton;
  
  public static final String ARG_LATITUDE = "latitude";
  public static final String ARG_LONGITUDE = "longitude";
  public static final String ARG_SHOW = "show";
  
  public static double myLat = 0.0;
  public static double myLng = 0.0;
  public static double showLat = 0.0;
  public static double showLng = 0.0;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detail);
    
    context = this;
    actionBar = getActionBar();
    map = (WristbandMap)getFragmentManager().findFragmentById(R.id.map);
    summaryText = (TextView)findViewById(R.id.summaryText);
    bandcampButton = (Button)findViewById(R.id.bandcampButton);
    songkickButton = (Button)findViewById(R.id.songkickButton);
    
    init();
  }
  
  private void init(){
    String s = getIntent().getStringExtra(ARG_SHOW);
    try {
      
      JSONObject json = new JSONObject(s);
      final Show show = new Show(json);
      map.setShow(show);
      map.setOnMarkerClickListener(this);
      
      myLat = getIntent().getDoubleExtra(ARG_LATITUDE, 0);
      myLng = getIntent().getDoubleExtra(ARG_LONGITUDE, 0);
      showLat = show.getVenueLatitude();
      showLng = show.getVenueLongitude();
      
      actionBar.setTitle(show.getVenueName());
      actionBar.setDisplayHomeAsUpEnabled(true);
      
      String summary = show.getBandName() + " @ " + show.getVenueName();
      summary += (show.getDateHuman().isEmpty()) ? "" : " at "+show.getDateHuman();
      summaryText.setText(summary);
      
      bandcampButton.setOnClickListener(new OnClickListener() {
        
        @Override
        public void onClick(View v) {
          Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
              Uri.parse(show.getBandcampUrl()));
          startActivity(intent);
        }
      });
      
      songkickButton.setOnClickListener(new OnClickListener() {
        
        @Override
        public void onClick(View v) {
          Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
              Uri.parse(show.getSongkickUrl()));
          startActivity(intent);
        }
      });
      
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    
  }
  
  @Override
  public boolean onMarkerClick(Marker marker) {
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
        Uri.parse("http://maps.google.com/maps?saddr="+myLat+","+myLng+"&daddr="+showLat+","+showLng));
    startActivity(intent);
    return true;
  }

}




Java Source Code List

android.UnusedStub.java
com.android.volley.AuthFailureError.java
com.android.volley.CacheDispatcher.java
com.android.volley.Cache.java
com.android.volley.DefaultRetryPolicy.java
com.android.volley.ExecutorDelivery.java
com.android.volley.NetworkDispatcher.java
com.android.volley.NetworkError.java
com.android.volley.NetworkResponse.java
com.android.volley.Network.java
com.android.volley.NoConnectionError.java
com.android.volley.ParseError.java
com.android.volley.RequestQueue.java
com.android.volley.Request.java
com.android.volley.ResponseDelivery.java
com.android.volley.Response.java
com.android.volley.RetryPolicy.java
com.android.volley.ServerError.java
com.android.volley.TimeoutError.java
com.android.volley.VolleyError.java
com.android.volley.VolleyLog.java
com.android.volley.toolbox.AndroidAuthenticator.java
com.android.volley.toolbox.Authenticator.java
com.android.volley.toolbox.BasicNetwork.java
com.android.volley.toolbox.ByteArrayPool.java
com.android.volley.toolbox.ClearCacheRequest.java
com.android.volley.toolbox.DiskBasedCache.java
com.android.volley.toolbox.HttpClientStack.java
com.android.volley.toolbox.HttpHeaderParser.java
com.android.volley.toolbox.HttpStack.java
com.android.volley.toolbox.HurlStack.java
com.android.volley.toolbox.ImageLoader.java
com.android.volley.toolbox.ImageRequest.java
com.android.volley.toolbox.JsonArrayRequest.java
com.android.volley.toolbox.JsonObjectRequest.java
com.android.volley.toolbox.JsonRequest.java
com.android.volley.toolbox.NetworkImageView.java
com.android.volley.toolbox.NoCache.java
com.android.volley.toolbox.PoolingByteArrayOutputStream.java
com.android.volley.toolbox.RequestFuture.java
com.android.volley.toolbox.StringRequest.java
com.android.volley.toolbox.Volley.java
com.nimo.wristband.DetailActivity.java
com.nimo.wristband.MainActivity.java
com.nimo.wristband.SettingsActivity.java
com.nimo.wristband.adapters.ShowListAdapter.java
com.nimo.wristband.constants.Constants.java
com.nimo.wristband.db.ShowData.java
com.nimo.wristband.db.SimpleStorage.java
com.nimo.wristband.fragments.MusicPlayerFragment.java
com.nimo.wristband.fragments.WristbandMap.java
com.nimo.wristband.net.BitmapLruCache.java
com.nimo.wristband.net.Show.java
com.nimo.wristband.net.WristbandRequest.java
com.nimo.wristband.net.WristbandResponse.java
com.nimo.wristband.service.WristbandPlayerService.java