Skip to content

Commit

Permalink
Adicionando um mapa qualquer #8
Browse files Browse the repository at this point in the history
  • Loading branch information
askmon committed Apr 18, 2014
1 parent 6cc0ba8 commit a25abd7
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 8 deletions.
17 changes: 15 additions & 2 deletions Ouvidoria/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
package="usp.ime.movel.ouvidoria"
android:versionCode="1"
android:versionName="1.0" >

<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
Expand All @@ -12,6 +14,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
Expand All @@ -23,7 +27,9 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<uses-library android:name="android.test.runner" />

<activity
Expand Down Expand Up @@ -54,6 +60,13 @@
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="usp.ime.movel.ouvidoria.Mapa"
android:label="@string/app_name" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCcPvHhiEv9idHNr4qv-za2VBUwr5QOWzU"/>
</application>

</manifest>
Expand Down
1 change: 1 addition & 0 deletions Ouvidoria/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@

# Project target.
target=android-19
android.library.reference.1=../../../Documents/adt-bundle-windows-x86_64-20140321/sdk/extras/google/google_play_services/libproject/google-play-services_lib
8 changes: 6 additions & 2 deletions Ouvidoria/res/layout/logado_ouvidor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />



<Button
android:id="@+id/listnew"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/list_new" />

<Button
android:id="@+id/showmap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/map" />


</LinearLayout>
12 changes: 12 additions & 0 deletions Ouvidoria/res/layout/mapa.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>
1 change: 1 addition & 0 deletions Ouvidoria/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<string name="enviar">Enviar</string>
<string name="gps">Adicionar local via GPS</string>
<string name="list_new">Listar novos incidentes</string>
<string name="map">Mostrar mapa</string>

</resources>
30 changes: 26 additions & 4 deletions Ouvidoria/src/usp/ime/movel/ouvidoria/LogadoOuvidor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package usp.ime.movel.ouvidoria;

import java.io.UnsupportedEncodingException;

import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.entity.AbstractHttpEntity;

import usp.ime.movel.ouvidoria.web.HttpEntityProvider;
import usp.ime.movel.ouvidoria.web.HttpPostRequest;
import usp.ime.movel.ouvidoria.web.InsecureHttpClientFactory;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
Expand All @@ -14,6 +22,7 @@ public class LogadoOuvidor extends OuvidoriaActivity implements OnClickListener
private String username;
private String uspid;
private Button mListnew;
private Button mShowmap;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -26,6 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
user.setText("Usuário: " + username);
mListnew = (Button) findViewById(R.id.listnew);
mListnew.setOnClickListener(this);
mListnew = (Button) findViewById(R.id.showmap);
mListnew.setOnClickListener(this);
}

@Override
Expand All @@ -38,10 +49,21 @@ && getConnectionState().getType() != "WIFI") {
Toast.makeText(LogadoOuvidor.this, "Pouca bateria e sem WIFI",
Toast.LENGTH_LONG).show();
} else {
Intent i = new Intent(LogadoOuvidor.this, ListarNovos.class);
i.putExtra("username", username);
i.putExtra("uspid", uspid);
startActivity(i);
Intent i;
switch (v.getId()) {
case R.id.listnew:
i = new Intent(LogadoOuvidor.this, ListarNovos.class);
i.putExtra("username", username);
i.putExtra("uspid", uspid);
startActivity(i);
break;
case R.id.showmap:
i = new Intent(LogadoOuvidor.this, Mapa.class);
startActivity(i);
break;
default:
break;
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions Ouvidoria/src/usp/ime/movel/ouvidoria/Mapa.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package usp.ime.movel.ouvidoria;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import android.os.Bundle;
import android.app.Activity;
import android.widget.Toast;


public class Mapa extends Activity {
static final LatLng TutorialsPoint = new LatLng(21 , 57);
private GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapa);
try {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().
findFragmentById(R.id.map)).getMap();
}
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
Marker TP = googleMap.addMarker(new MarkerOptions().
position(TutorialsPoint).title("TutorialsPoint"));

} catch (Exception e) {
e.printStackTrace();
}

}

}

0 comments on commit a25abd7

Please sign in to comment.