drawer is working
This commit is contained in:
parent
2a856156cc
commit
46d8531c21
7 changed files with 130 additions and 100 deletions
|
@ -1,62 +1,53 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v7.widget.Toolbar
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
|
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
app:contentInsetStart="4dp"
|
android:background="@color/actionbar_light_color"
|
||||||
app:contentInsetLeft="4dp"
|
app:contentInsetLeft="4dp"
|
||||||
android:background="@color/actionbar_light_color" >
|
app:contentInsetStart="4dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_back"
|
android:id="@+id/toolbar_back"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="@dimen/list_item_height"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:scaleType="center"
|
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha" />
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/toolbar_list"
|
||||||
|
android:layout_width="@dimen/list_item_height"
|
||||||
|
android:layout_height="@dimen/list_item_height"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:background="@drawable/dashboard_button_light"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_navigation_drawer"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/toolbar_settings"
|
||||||
|
android:layout_width="@dimen/list_item_height"
|
||||||
|
android:layout_height="@dimen/list_item_height"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:background="@drawable/dashboard_button_light"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_settings"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/toolbar_text"
|
android:id="@+id/toolbar_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:textSize="@dimen/abc_text_size_headline_material"
|
android:scaleType="center"
|
||||||
|
android:text="Toolbar"
|
||||||
android:textColor="@color/abc_primary_text_material_dark"
|
android:textColor="@color/abc_primary_text_material_dark"
|
||||||
android:scaleType="center"
|
android:textSize="@dimen/abc_text_size_headline_material"
|
||||||
android:text="Toolbar" />
|
tools:visibility="gone"/>
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toolbar_list"
|
|
||||||
android:layout_width="@dimen/list_item_height"
|
|
||||||
android:layout_height="@dimen/list_item_height"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:background="@drawable/dashboard_button_light"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/ic_navigation_drawer" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toolbar_settings"
|
|
||||||
android:layout_width="@dimen/list_item_height"
|
|
||||||
android:layout_height="@dimen/list_item_height"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:background="@drawable/dashboard_button_light"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/ic_action_settings" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toolbar_configure_screen"
|
|
||||||
android:layout_width="@dimen/list_item_height"
|
|
||||||
android:layout_height="@dimen/list_item_height"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:background="@drawable/dashboard_button_light"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/ic_configure_screen_dark" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_ok"
|
android:id="@+id/toolbar_ok"
|
||||||
|
@ -65,7 +56,7 @@
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_done" />
|
android:src="@drawable/ic_action_done"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_sort"
|
android:id="@+id/toolbar_sort"
|
||||||
|
@ -74,7 +65,7 @@
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_sort_waypoint_dark" />
|
android:src="@drawable/ic_sort_waypoint_dark"/>
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -84,8 +75,8 @@
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:visibility="gone"
|
android:src="@drawable/ic_flat_list_dark"
|
||||||
android:src="@drawable/ic_flat_list_dark" />
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_edit"
|
android:id="@+id/toolbar_edit"
|
||||||
|
@ -94,8 +85,8 @@
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:visibility="gone"
|
android:src="@drawable/ic_action_edit_dark"
|
||||||
android:src="@drawable/ic_action_edit_dark" />
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,7 @@ public class ContextMenuAdapter {
|
||||||
if (layoutId == R.layout.simple_list_menu_item) {
|
if (layoutId == R.layout.simple_list_menu_item) {
|
||||||
float density = activity.getResources().getDisplayMetrics().density;
|
float density = activity.getResources().getDisplayMetrics().density;
|
||||||
int paddingInPixels = (int) (24 * density);
|
int paddingInPixels = (int) (24 * density);
|
||||||
int drawableSizeInPixels = (int) (50 * density); // 32
|
int drawableSizeInPixels = (int) (32 * density); // 32
|
||||||
imageId.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
|
imageId.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
|
||||||
tv.setCompoundDrawables(imageId, null, null, null);
|
tv.setCompoundDrawables(imageId, null, null, null);
|
||||||
tv.setCompoundDrawablePadding(paddingInPixels);
|
tv.setCompoundDrawablePadding(paddingInPixels);
|
||||||
|
|
|
@ -15,14 +15,18 @@ import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.support.v4.app.NotificationCompat.Builder;
|
import android.support.v4.app.NotificationCompat.Builder;
|
||||||
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.NotificationCompat;
|
import android.support.v7.app.NotificationCompat;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -46,6 +50,7 @@ import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.AppInitializer.InitEvents;
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.BusyIndicator;
|
import net.osmand.plus.BusyIndicator;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.FirstUsageFragment;
|
import net.osmand.plus.FirstUsageFragment;
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -91,7 +96,9 @@ public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/**
|
||||||
|
* Called when the activity is first created.
|
||||||
|
*/
|
||||||
private OsmandMapTileView mapView;
|
private OsmandMapTileView mapView;
|
||||||
private AtlasMapRendererView atlasMapRendererView;
|
private AtlasMapRendererView atlasMapRendererView;
|
||||||
|
|
||||||
|
@ -121,6 +128,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
||||||
private AppInitializeListener initListener;
|
private AppInitializeListener initListener;
|
||||||
private IMapDownloaderCallback downloaderCallback;
|
private IMapDownloaderCallback downloaderCallback;
|
||||||
|
private DrawerLayout drawerLayout;
|
||||||
|
|
||||||
private Notification getNotification() {
|
private Notification getNotification() {
|
||||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||||
|
@ -135,7 +143,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
final Builder noti = new NotificationCompat.Builder(
|
final Builder noti = new NotificationCompat.Builder(
|
||||||
this).setContentTitle(Version.getAppName(app))
|
this).setContentTitle(Version.getAppName(app))
|
||||||
.setContentText(getString(R.string.go_back_to_osmand))
|
.setContentText(getString(R.string.go_back_to_osmand))
|
||||||
.setSmallIcon(smallIcon )
|
.setSmallIcon(smallIcon)
|
||||||
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
|
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
|
||||||
.setContentIntent(pi).setOngoing(true);
|
.setContentIntent(pi).setOngoing(true);
|
||||||
return noti.build();
|
return noti.build();
|
||||||
|
@ -210,19 +218,34 @@ public class MapActivity extends AccessibleActivity {
|
||||||
OsmandPlugin.onMapActivityCreate(this);
|
OsmandPlugin.onMapActivityCreate(this);
|
||||||
gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView());
|
gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView());
|
||||||
wakeLockHelper = new WakeLockHelper(getMyApplication());
|
wakeLockHelper = new WakeLockHelper(getMyApplication());
|
||||||
if(System.currentTimeMillis() - tm > 50) {
|
if (System.currentTimeMillis() - tm > 50) {
|
||||||
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
|
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
|
||||||
}
|
}
|
||||||
mapView.refreshMap(true);
|
mapView.refreshMap(true);
|
||||||
|
|
||||||
if(getMyApplication().getAppInitializer().isFirstTime(this)) {
|
if (getMyApplication().getAppInitializer().isFirstTime(this)) {
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.add(R.id.fragmentContainer, new FirstUsageFragment(),
|
.add(R.id.fragmentContainer, new FirstUsageFragment(),
|
||||||
FirstUsageFragment.TAG).commit();
|
FirstUsageFragment.TAG).commit();
|
||||||
}
|
}
|
||||||
ListView menuItemsListView = (ListView) findViewById(R.id.menuItems);
|
final ListView menuItemsListView = (ListView) findViewById(R.id.menuItems);
|
||||||
menuItemsListView.setDivider(null);
|
menuItemsListView.setDivider(null);
|
||||||
menuItemsListView.setAdapter(mapActions.createMainOptionsMenu().createSimpleListAdapter(this, true));
|
final ContextMenuAdapter contextMenuAdapter = mapActions.createMainOptionsMenu();
|
||||||
|
final ArrayAdapter<?> simpleListAdapter = contextMenuAdapter.createSimpleListAdapter(this, true);
|
||||||
|
menuItemsListView.setAdapter(simpleListAdapter);
|
||||||
|
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
ContextMenuAdapter.OnContextMenuClick click =
|
||||||
|
contextMenuAdapter.getClickAdapter(position);
|
||||||
|
if (click.onContextMenuClick(simpleListAdapter,
|
||||||
|
contextMenuAdapter.getElementId(position), position, false)) {
|
||||||
|
closeDrawer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAppInitialization() {
|
private void checkAppInitialization() {
|
||||||
|
@ -230,20 +253,21 @@ public class MapActivity extends AccessibleActivity {
|
||||||
findViewById(R.id.init_progress).setVisibility(View.VISIBLE);
|
findViewById(R.id.init_progress).setVisibility(View.VISIBLE);
|
||||||
initListener = new AppInitializeListener() {
|
initListener = new AppInitializeListener() {
|
||||||
boolean openGlSetup = false;
|
boolean openGlSetup = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(AppInitializer init, InitEvents event) {
|
public void onProgress(AppInitializer init, InitEvents event) {
|
||||||
String tn = init.getCurrentInitTaskName();
|
String tn = init.getCurrentInitTaskName();
|
||||||
if (tn != null) {
|
if (tn != null) {
|
||||||
((TextView) findViewById(R.id.ProgressMessage)).setText(tn);
|
((TextView) findViewById(R.id.ProgressMessage)).setText(tn);
|
||||||
}
|
}
|
||||||
if(event == InitEvents.NATIVE_INITIALIZED) {
|
if (event == InitEvents.NATIVE_INITIALIZED) {
|
||||||
setupOpenGLView(false);
|
setupOpenGLView(false);
|
||||||
openGlSetup = true;
|
openGlSetup = true;
|
||||||
}
|
}
|
||||||
if(event == InitEvents.MAPS_INITIALIZED) {
|
if (event == InitEvents.MAPS_INITIALIZED) {
|
||||||
// TODO investigate if this false cause any issues!
|
// TODO investigate if this false cause any issues!
|
||||||
mapView.refreshMap(false);
|
mapView.refreshMap(false);
|
||||||
if(dashboardOnMap != null) {
|
if (dashboardOnMap != null) {
|
||||||
dashboardOnMap.updateLocation(true, true, false);
|
dashboardOnMap.updateLocation(true, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,11 +275,11 @@ public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(AppInitializer init) {
|
public void onFinish(AppInitializer init) {
|
||||||
if(!openGlSetup) {
|
if (!openGlSetup) {
|
||||||
setupOpenGLView(false);
|
setupOpenGLView(false);
|
||||||
}
|
}
|
||||||
mapView.refreshMap(false);
|
mapView.refreshMap(false);
|
||||||
if(dashboardOnMap != null) {
|
if (dashboardOnMap != null) {
|
||||||
dashboardOnMap.updateLocation(true, true, false);
|
dashboardOnMap.updateLocation(true, true, false);
|
||||||
}
|
}
|
||||||
findViewById(R.id.init_progress).setVisibility(View.GONE);
|
findViewById(R.id.init_progress).setVisibility(View.GONE);
|
||||||
|
@ -348,7 +372,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if(dashboardOnMap.onBackPressed()) {
|
if (dashboardOnMap.onBackPressed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
|
@ -359,7 +383,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
long tm = System.currentTimeMillis();
|
long tm = System.currentTimeMillis();
|
||||||
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {
|
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {
|
||||||
if(!dashboardOnMap.isVisible()) {
|
if (!dashboardOnMap.isVisible()) {
|
||||||
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
|
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,7 +476,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
atlasMapRendererView.handleOnResume();
|
atlasMapRendererView.handleOnResume();
|
||||||
}
|
}
|
||||||
getMyApplication().getAppCustomization().resumeActivity(MapActivity.class, this);
|
getMyApplication().getAppCustomization().resumeActivity(MapActivity.class, this);
|
||||||
if(System.currentTimeMillis() - tm > 50) {
|
if (System.currentTimeMillis() - tm > 50) {
|
||||||
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
|
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,12 +519,12 @@ public class MapActivity extends AccessibleActivity {
|
||||||
loc.setLatitude(mapView.getLatitude());
|
loc.setLatitude(mapView.getLatitude());
|
||||||
loc.setLongitude(mapView.getLongitude());
|
loc.setLongitude(mapView.getLongitude());
|
||||||
getMapActions().enterRoutePlanningMode(null, null, status == OsmandSettings.NAVIGATE_CURRENT_GPX);
|
getMapActions().enterRoutePlanningMode(null, null, status == OsmandSettings.NAVIGATE_CURRENT_GPX);
|
||||||
if(dashboardOnMap.isVisible()) {
|
if (dashboardOnMap.isVisible()) {
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (latLonToShow != null) {
|
if (latLonToShow != null) {
|
||||||
if(dashboardOnMap.isVisible()) {
|
if (dashboardOnMap.isVisible()) {
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
if (mapLabelToShow != null) {
|
if (mapLabelToShow != null) {
|
||||||
|
@ -567,7 +591,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
AccessibleToast.makeText(this, R.string.edit_tilesource_maxzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
AccessibleToast.makeText(this, R.string.edit_tilesource_maxzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(newZoom < 1) {
|
if (newZoom < 1) {
|
||||||
AccessibleToast.makeText(this, R.string.edit_tilesource_minzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
AccessibleToast.makeText(this, R.string.edit_tilesource_minzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -601,7 +625,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
LatLon loc = getMapLocation();
|
LatLon loc = getMapLocation();
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
||||||
if(mapViewTrackingUtilities.isMapLinkedToLocation()) {
|
if (mapViewTrackingUtilities.isMapLinkedToLocation()) {
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
||||||
}
|
}
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
|
@ -695,14 +719,14 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatLon getMapLocation() {
|
public LatLon getMapLocation() {
|
||||||
if(mapView == null) {
|
if (mapView == null) {
|
||||||
return settings.getLastKnownMapLocation();
|
return settings.getLastKnownMapLocation();
|
||||||
}
|
}
|
||||||
return new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
return new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getMapRotate() {
|
public float getMapRotate() {
|
||||||
if(mapView == null) {
|
if (mapView == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mapView.getRotate();
|
return mapView.getRotate();
|
||||||
|
@ -763,7 +787,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMapSettings() {
|
public void updateMapSettings() {
|
||||||
if(app.isApplicationInitializing()) {
|
if (app.isApplicationInitializing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// update vector renderer
|
// update vector renderer
|
||||||
|
@ -786,7 +810,11 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
protected void onPostExecute(Void result) {};
|
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}.execute((Void) null);
|
}.execute((Void) null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -826,7 +854,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkExternalStorage() {
|
public void checkExternalStorage() {
|
||||||
if(Build.VERSION.SDK_INT >= 19) {
|
if (Build.VERSION.SDK_INT >= 19) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String state = Environment.getExternalStorageState();
|
String state = Environment.getExternalStorageState();
|
||||||
|
@ -916,7 +944,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
OsmandPlugin.onMapActivityResult(requestCode, resultCode, data);
|
OsmandPlugin.onMapActivityResult(requestCode, resultCode, data);
|
||||||
MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
|
MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
|
||||||
if(mcl != null) {
|
if (mcl != null) {
|
||||||
mcl.onActivityResult(requestCode, resultCode, data);
|
mcl.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,4 +960,20 @@ public class MapActivity extends AccessibleActivity {
|
||||||
public DashboardOnMap getDashboard() {
|
public DashboardOnMap getDashboard() {
|
||||||
return dashboardOnMap;
|
return dashboardOnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openDrawer() {
|
||||||
|
drawerLayout.openDrawer(Gravity.LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableDrawer() {
|
||||||
|
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableDrawer() {
|
||||||
|
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeDrawer() {
|
||||||
|
drawerLayout.closeDrawer(Gravity.LEFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,6 +544,15 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||||
|
|
||||||
|
optionsMenuHelper.item(R.string.home).iconColor(R.drawable.map_dashboard)
|
||||||
|
.listen(new OnContextMenuClick() {
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
mapActivity.closeDrawer();
|
||||||
|
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).reg();
|
||||||
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -239,8 +240,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
flat.setVisibility(View.GONE);
|
flat.setVisibility(View.GONE);
|
||||||
ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
|
ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
|
||||||
settingsButton.setVisibility(View.GONE);
|
settingsButton.setVisibility(View.GONE);
|
||||||
ImageView configureScreen = (ImageView) dashboardView.findViewById(R.id.toolbar_configure_screen);
|
|
||||||
configureScreen.setVisibility(View.GONE);
|
|
||||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||||
ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
|
ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
|
||||||
lst.setVisibility(View.GONE);
|
lst.setVisibility(View.GONE);
|
||||||
|
@ -302,15 +301,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
|
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
|
||||||
configureScreen.setVisibility(View.VISIBLE);
|
|
||||||
configureScreen.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
settingsButton.setVisibility(View.VISIBLE);
|
settingsButton.setVisibility(View.VISIBLE);
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@ -321,19 +311,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
lst.setVisibility(View.VISIBLE);
|
lst.setVisibility(View.VISIBLE);
|
||||||
if (visibleType == DashboardType.DASHBOARD) {
|
|
||||||
lst.setImageDrawable(iconsCache.getIcon(R.drawable.ic_navigation_drawer));
|
|
||||||
} else if (visibleType == DashboardType.LIST_MENU) {
|
|
||||||
lst.setImageDrawable(iconsCache.getIcon(R.drawable.ic_dashboard_dark));
|
|
||||||
}
|
|
||||||
lst.setOnClickListener(new View.OnClickListener() {
|
lst.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (visibleType == DashboardType.DASHBOARD) {
|
hideDashboard(false);
|
||||||
setDashboardVisibility(true, DashboardType.LIST_MENU, null, true);
|
mapActivity.openDrawer();
|
||||||
} else {
|
|
||||||
setDashboardVisibility(true, DashboardType.DASHBOARD, null, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -441,12 +424,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
this.visibleType = type;
|
this.visibleType = type;
|
||||||
DashboardOnMap.staticVisible = visible;
|
DashboardOnMap.staticVisible = visible;
|
||||||
DashboardOnMap.staticVisibleType = type;
|
DashboardOnMap.staticVisibleType = type;
|
||||||
|
mapActivity.enableDrawer();
|
||||||
if (visible) {
|
if (visible) {
|
||||||
mapViewLocation = mapActivity.getMapLocation();
|
mapViewLocation = mapActivity.getMapLocation();
|
||||||
mapRotation = mapActivity.getMapRotate();
|
mapRotation = mapActivity.getMapRotate();
|
||||||
mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||||
myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||||
mapActivity.getMapViewTrackingUtilities().setDashboard(this);
|
mapActivity.getMapViewTrackingUtilities().setDashboard(this);
|
||||||
|
mapActivity.disableDrawer();
|
||||||
dashboardView.setVisibility(View.VISIBLE);
|
dashboardView.setVisibility(View.VISIBLE);
|
||||||
if (isActionButtonVisible()) {
|
if (isActionButtonVisible()) {
|
||||||
actionButton.setVisibility(View.VISIBLE);
|
actionButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -385,7 +385,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
|
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
|
||||||
|
|
||||||
|
|
||||||
menuControl = createHudButton((ImageView) backToMenuButton, R.drawable.map_dashboard).setBg(
|
menuControl = createHudButton((ImageView) backToMenuButton, R.drawable.ic_navigation_drawer).setBg(
|
||||||
R.drawable.btn_round, R.drawable.btn_round_night);
|
R.drawable.btn_round, R.drawable.btn_round_night);
|
||||||
controls.add(menuControl);
|
controls.add(menuControl);
|
||||||
backToMenuButton.setOnClickListener(new View.OnClickListener() {
|
backToMenuButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -395,7 +395,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
// double lon = activity.getMapView().getLongitude();
|
// double lon = activity.getMapView().getLongitude();
|
||||||
// MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon));
|
// MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon));
|
||||||
notifyClicked();
|
notifyClicked();
|
||||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
mapActivity.openDrawer();
|
||||||
|
// mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mapAppModeShadow = mapActivity.findViewById(R.id.map_app_mode_shadow);
|
mapAppModeShadow = mapActivity.findViewById(R.id.map_app_mode_shadow);
|
||||||
|
|
Loading…
Reference in a new issue