Added activity

This commit is contained in:
Denis 2014-11-05 14:47:42 +02:00
parent 24af7d9734
commit 80990295c5
3 changed files with 79 additions and 13 deletions

View file

@ -67,6 +67,7 @@
</activity> </activity>
<activity android:name="net.osmand.plus.activities.HelpActivity" /> <activity android:name="net.osmand.plus.activities.HelpActivity" />
<activity android:name=".activities.DashboardActivity" />
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name" <activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
android:screenOrientation="unspecified" android:launchMode="singleTop"> android:screenOrientation="unspecified" android:launchMode="singleTop">

View file

@ -6,46 +6,69 @@
android:padding="8dp" android:padding="8dp"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout android:id="@+id/search" <LinearLayout android:id="@+id/search"
android:orientation="horizontal" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView android:text="@string/tip_search"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/home" <LinearLayout android:id="@+id/home"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView android:id="@+id/home_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:text="@string/favorite_home_category"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<Button android:text="@string/tip_navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/map" <LinearLayout android:orientation="vertical"
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<LinearLayout android:layout_width="wrap_content" android:layout_height="fill_parent"> <LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/map_name" <TextView android:id="@+id/map_name"
android:text="@string/map_Button" android:text="@string/map_Button"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="fill_parent"/> android:layout_height="fill_parent"
android:layout_weight="1"/>
<Button android:id="@+id/show_on_map"
android:text="@string/search_shown_on_map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<net.osmand.plus.views.OsmAndMapSurfaceView
android:id="@+id/MapView"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:contentDescription="@string/map_view"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<LinearLayout android:orientation="horizontal" <LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_width="fill_parent"
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/my_data_Button"
android:layout_weight="1"/> android:layout_weight="1"/>
<Button android:id="@+id/btn_show_all" <Button android:id="@+id/btn_show_all"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<ListView android:id="@+id/list_favorites" <ListView android:id="@+id/list_favorites"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,42 @@
package net.osmand.plus.activities;
import android.os.Bundle;
import android.view.View;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import net.osmand.plus.R;
import net.osmand.plus.render.MapVectorLayer;
import net.osmand.plus.sherpafy.StageFavoritesLayer;
import net.osmand.plus.views.GPXLayer;
import net.osmand.plus.views.MapTextLayer;
import net.osmand.plus.views.OsmAndMapSurfaceView;
import net.osmand.plus.views.OsmandMapTileView;
/**
* Created by Denis on 05.11.2014.
*/
public class DashboardActivity extends SherlockFragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard);
prepareMapView();
}
private void prepareMapView() {
OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) findViewById(R.id.MapView);
OsmandMapTileView osmandMapTileView = surf.getMapView();
osmandMapTileView.getView().setVisibility(View.VISIBLE);
osmandMapTileView.removeAllLayers();
MapVectorLayer mapVectorLayer = new MapVectorLayer(null);
MapTextLayer mapTextLayer = new MapTextLayer();
mapTextLayer.setAlwaysVisible(true);
// 5.95 all labels
osmandMapTileView.addLayer(mapTextLayer, 5.95f);
osmandMapTileView.addLayer(mapVectorLayer, 0.5f);
osmandMapTileView.setMainLayer(mapVectorLayer);
mapVectorLayer.setVisible(true);
}
}