Skip to content

Commit

Permalink
Pridany mapy
Browse files Browse the repository at this point in the history
  • Loading branch information
Saljack committed Nov 7, 2012
1 parent 8f302fd commit e2f5769
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 12 deletions.
16 changes: 13 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.cvut.fel.nur.zavody"
android:versionCode="1"
android:versionName="1.0">
package="cz.cvut.fel.nur.zavody"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<uses-library android:name="com.google.android.maps" />
<activity android:name="MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="cz.cvut.fel.nur.zavody.activity.NormalMode"
android:label="@string/ma_maps">
<uses-library android:name="com.google.android.maps" />
</activity>
</application>
</manifest>
Empty file.
7 changes: 4 additions & 3 deletions res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
<Button
android:id="@+id/ma_button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, MainActivity"
/>
android:text="@string/ma_maps"
/>
</LinearLayout>

16 changes: 16 additions & 0 deletions res/layout/normal_mode.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/nm_map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:enabled="true"
android:clickable="true"
android:apiKey="0FWL-kvtGWbNHGzJfBDEDEGUfv-3YSFzDjNXJAw"
/>
</LinearLayout>
37 changes: 37 additions & 0 deletions res/menu/main_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <item android:id="@+id/rate"
android:icon="@drawable/ic_menu_star"
android:title="@string/rate"
android:showAsAction="withText|always"
android:visible="false"
/>-->
<!-- <item android:id="@+id/up"
android:icon="@drawable/folder_up"
android:title="@string/Up"
android:showAsAction="withText|always"
android:visible="false"
/>
<item android:id="@+id/menu_share"
android:showAsAction="ifRoom"
android:title="@string/share"
android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider"
android:visible="false"
/>
<item android:id="@+id/menu_delete"
android:icon="@drawable/ic_menu_delete"
android:showAsAction="ifRoom"
android:title="@string/delete"
android:visible="false"
/>
<item android:id="@+id/preferences"
android:icon="@drawable/ic_menu_preferences"
android:title="@string/preferences"
android:showAsAction="never"
/>
<item android:id="@+id/about"
android:icon="@drawable/ic_menu_info_details"
android:showAsAction="never"
android:title="@string/about" />-->
</menu>
5 changes: 4 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MainActivity</string>
<string name="app_name">Závody</string>

<!-- MainActivity -->
<string name="ma_maps">Mapy</string>
</resources>
42 changes: 37 additions & 5 deletions src/cz/cvut/fel/nur/zavody/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
package cz.cvut.fel.nur.zavody;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;
import cz.cvut.fel.nur.zavody.activity.NormalMode;

public class MainActivity extends Activity
{
/** Called when the activity is first created. */
/**
* Tohle je první volaná aktivita
*
* @author saljack
*/
public class MainActivity extends Activity {

private Button _mapsButton;

/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState)
{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_mapsButton = (Button) findViewById(R.id.ma_button01);
_mapsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startMapsActivity();
}
});
}

private void startMapsActivity() {
Intent intent = new Intent(MainActivity.this, NormalMode.class);
startActivity(intent);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
return true;
}
}
34 changes: 34 additions & 0 deletions src/cz/cvut/fel/nur/zavody/activity/NormalMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cz.cvut.fel.nur.zavody.activity;

import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import cz.cvut.fel.nur.zavody.R;

/**
*
* @author saljack
*/
public class NormalMode extends MapActivity {

/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.normal_mode);
MapView mapView = (MapView) findViewById(R.id.nm_map);
mapView.setBuiltInZoomControls(true);
}

@Override
protected boolean isRouteDisplayed() {
return true;
}
}

0 comments on commit e2f5769

Please sign in to comment.