commit
113fd84c89
10 changed files with 344 additions and 239 deletions
|
@ -1,63 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
<android.support.v7.widget.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_height="@dimen/dashboard_map_toolbar"
|
||||
app:contentInsetStart="4dp"
|
||||
android:background="@color/actionbar_light_color"
|
||||
app:contentInsetLeft="4dp"
|
||||
android:background="@color/actionbar_light_color" >
|
||||
app:contentInsetStart="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_back"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="left"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textSize="@dimen/abc_text_size_headline_material"
|
||||
android:textColor="@color/abc_primary_text_material_dark"
|
||||
android:scaleType="center"
|
||||
android:text="Toolbar" />
|
||||
|
||||
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="right"
|
||||
android:layout_gravity="left"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_navigation_drawer" />
|
||||
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:layout_gravity="left"
|
||||
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" />
|
||||
|
||||
|
||||
|
||||
android:src="@drawable/ic_action_settings"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:scaleType="center"
|
||||
android:text="Toolbar"
|
||||
android:textColor="@color/abc_primary_text_material_dark"
|
||||
android:textSize="@dimen/abc_text_size_headline_material"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_ok"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
|
@ -65,8 +56,8 @@
|
|||
android:layout_gravity="right"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_done" />
|
||||
|
||||
android:src="@drawable/ic_action_done"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_sort"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
|
@ -74,9 +65,9 @@
|
|||
android:layout_gravity="right"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_sort_waypoint_dark" />
|
||||
|
||||
|
||||
android:src="@drawable/ic_sort_waypoint_dark"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_flat"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
|
@ -84,8 +75,8 @@
|
|||
android:layout_gravity="right"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_flat_list_dark" />
|
||||
android:src="@drawable/ic_flat_list_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_edit"
|
||||
|
@ -94,8 +85,8 @@
|
|||
android:layout_gravity="right"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
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>
|
|
@ -6,7 +6,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="@color/dashboard_background"
|
||||
android:orientation="vertical"
|
||||
tools:context="net.osmand.plus.osmedit.EditPoiFragment">
|
||||
tools:context="net.osmand.plus.osmedit.EditPoiFragment"
|
||||
android:clickable="true">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/LinearLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip"
|
||||
android:background="@color/color_white">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/LinearLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip"
|
||||
android:background="@color/color_white">
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="14dip"
|
||||
|
@ -15,19 +16,23 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_vertical" />
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:visibility="visible"
|
||||
tools:background="@drawable/ic_action_delete_dark"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dip"
|
||||
android:layout_marginLeft="16dp"
|
||||
tools:drawableLeft="@drawable/ic_action_search_dark"
|
||||
android:layout_marginTop="11dip"
|
||||
android:layout_marginBottom="11dip"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layer_poi"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:textColor="@color/color_black"
|
||||
android:drawablePadding="24dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -1,55 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
android:id="@+id/drawer_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/MapViewWithLayers"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:keepScreenOn="true"
|
||||
android:orientation="vertical" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/atlasMapRendererViewStub"
|
||||
<FrameLayout
|
||||
android:id="@+id/MapViewWithLayers"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:keepScreenOn="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/atlasMapRendererViewStub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inflatedId="@+id/atlasMapRendererView"
|
||||
android:layout="@layout/atlas_map_renderer_view"/>
|
||||
|
||||
<net.osmand.plus.views.OsmAndMapSurfaceView
|
||||
android:id="@+id/MapView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/shared_string_map"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<net.osmand.plus.views.OsmAndMapLayersView
|
||||
android:id="@+id/MapLayersView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/shared_string_map"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/MapHudButtonsOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inflatedId="@+id/atlasMapRendererView"
|
||||
android:layout="@layout/atlas_map_renderer_view" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<net.osmand.plus.views.OsmAndMapSurfaceView
|
||||
android:id="@+id/MapView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/shared_string_map"
|
||||
android:visibility="gone" />
|
||||
<include layout="@layout/map_hud_top"/>
|
||||
|
||||
<net.osmand.plus.views.OsmAndMapLayersView
|
||||
android:id="@+id/MapLayersView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/shared_string_map"
|
||||
android:visibility="gone" />
|
||||
<include layout="@layout/map_hud_bottom"/>
|
||||
</FrameLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/dashboard_over_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/MapHudButtonsOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
<include layout="@layout/map_hud_top" />
|
||||
<include layout="@layout/map_hud_bottom" />
|
||||
</FrameLayout>
|
||||
|
||||
<include
|
||||
android:layout_width="match_parent"
|
||||
<ListView
|
||||
android:id="@+id/menuItems"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/dashboard_over_map" />
|
||||
android:layout_gravity="left"
|
||||
android:background="@color/dashboard_background"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</FrameLayout>
|
||||
</android.support.v4.widget.DrawerLayout>
|
14
OsmAnd/res/layout/simple_list_menu_item.xml
Normal file
14
OsmAnd/res/layout/simple_list_menu_item.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="16dp"
|
||||
android:text="@string/layer_poi"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
tools:drawableLeft="@drawable/ic_action_search_dark"/>
|
|
@ -23,8 +23,12 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class ContextMenuAdapter {
|
||||
|
||||
// Log log =
|
||||
|
||||
public interface OnContextMenuClick {
|
||||
//boolean return type needed to desribe if drawer needed to be close or not
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
|
@ -289,91 +293,121 @@ public class ContextMenuAdapter {
|
|||
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
||||
final int layoutId = defaultLayoutId;
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layoutId, R.id.title,
|
||||
getItemNames()) {
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// User super class to create the View
|
||||
View v = convertView;
|
||||
Integer lid = getLayoutId(position);
|
||||
if (lid == R.layout.mode_toggles){
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selected.size() > 0) {
|
||||
app.getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
if (changeAppModeListener != null) {
|
||||
changeAppModeListener.onClick(allModes.getResult());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (v == null || (v.getTag() != lid)) {
|
||||
v = activity.getLayoutInflater().inflate(lid, null);
|
||||
v.setTag(lid);
|
||||
}
|
||||
TextView tv = (TextView) v.findViewById(R.id.title);
|
||||
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
|
||||
|
||||
Drawable imageId = getImage(app, position, holoLight);
|
||||
if (imageId != null) {
|
||||
((ImageView) v.findViewById(R.id.icon)).setImageDrawable(imageId);
|
||||
v.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||
} else if (v.findViewById(R.id.icon) != null){
|
||||
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(isCategory(position)) {
|
||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
tv.setTypeface(null);
|
||||
}
|
||||
|
||||
if (v.findViewById(R.id.check_item) != null) {
|
||||
final CompoundButton ch = (CompoundButton) v.findViewById(R.id.check_item);
|
||||
if(selectedList.get(position) != -1) {
|
||||
ch.setOnCheckedChangeListener(null);
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
ch.setChecked(selectedList.get(position) > 0);
|
||||
final ArrayAdapter<String> la = this;
|
||||
final OnCheckedChangeListener listener = new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
OnContextMenuClick ca = getClickAdapter(position);
|
||||
selectedList.set(position, isChecked ? 1 : 0);
|
||||
if (ca != null) {
|
||||
ca.onContextMenuClick(la, getElementId(position), position, isChecked);
|
||||
}
|
||||
}
|
||||
};
|
||||
ch.setOnCheckedChangeListener(listener);
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
} else if (ch != null) {
|
||||
ch.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (v.findViewById(R.id.ProgressBar) != null){
|
||||
ProgressBar bar = (ProgressBar) v.findViewById(R.id.ProgressBar);
|
||||
if(loadingList.get(position) == 1){
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
String itemDescr = getItemDescr(position);
|
||||
if (v.findViewById(R.id.descr) != null){
|
||||
((TextView)v.findViewById(R.id.descr)).setText(itemDescr);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
ArrayAdapter<String> listAdapter = new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
|
||||
getItemNames(), app, holoLight);
|
||||
return listAdapter;
|
||||
}
|
||||
|
||||
public ArrayAdapter<?> createSimpleListAdapter(final Activity activity, final boolean holoLight) {
|
||||
final int layoutId = R.layout.simple_list_menu_item;
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
ArrayAdapter<String> listAdapter = new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
|
||||
getItemNames(), app, holoLight);
|
||||
return listAdapter;
|
||||
}
|
||||
|
||||
public class ContextMenuArrayAdapter extends ArrayAdapter<String> {
|
||||
private Activity activity;
|
||||
private OsmandApplication app;
|
||||
private boolean holoLight;
|
||||
private int layoutId;
|
||||
public ContextMenuArrayAdapter(Activity context, int resource, int textViewResourceId,
|
||||
String[] objects, OsmandApplication app, boolean holoLight) {
|
||||
super(context, resource, textViewResourceId, objects);
|
||||
activity = context;
|
||||
this.app = app;
|
||||
this.holoLight = holoLight;
|
||||
layoutId = resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// User super class to create the View
|
||||
Integer lid = getLayoutId(position);
|
||||
if (lid == R.layout.mode_toggles){
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selected.size() > 0) {
|
||||
app.getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
if (changeAppModeListener != null) {
|
||||
changeAppModeListener.onClick(allModes.getResult());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (convertView == null || (convertView.getTag() != lid)) {
|
||||
convertView = activity.getLayoutInflater().inflate(lid, null);
|
||||
convertView.setTag(lid);
|
||||
}
|
||||
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
||||
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
|
||||
|
||||
Drawable imageId = getImage(app, position, holoLight);
|
||||
if (imageId != null) {
|
||||
if (layoutId == R.layout.simple_list_menu_item) {
|
||||
float density = activity.getResources().getDisplayMetrics().density;
|
||||
int paddingInPixels = (int) (24 * density);
|
||||
int drawableSizeInPixels = (int) (32 * density); // 32
|
||||
imageId.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
|
||||
tv.setCompoundDrawables(imageId, null, null, null);
|
||||
tv.setCompoundDrawablePadding(paddingInPixels);
|
||||
} else {
|
||||
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(imageId);
|
||||
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (convertView.findViewById(R.id.icon) != null){
|
||||
convertView.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(isCategory(position)) {
|
||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
tv.setTypeface(null);
|
||||
}
|
||||
|
||||
if (convertView.findViewById(R.id.check_item) != null) {
|
||||
final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.check_item);
|
||||
if(selectedList.get(position) != -1) {
|
||||
ch.setOnCheckedChangeListener(null);
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
ch.setChecked(selectedList.get(position) > 0);
|
||||
final ArrayAdapter<String> la = this;
|
||||
final OnCheckedChangeListener listener = new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
OnContextMenuClick ca = getClickAdapter(position);
|
||||
selectedList.set(position, isChecked ? 1 : 0);
|
||||
if (ca != null) {
|
||||
ca.onContextMenuClick(la, getElementId(position), position, isChecked);
|
||||
}
|
||||
}
|
||||
};
|
||||
ch.setOnCheckedChangeListener(listener);
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
} else if (ch != null) {
|
||||
ch.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (convertView.findViewById(R.id.ProgressBar) != null){
|
||||
ProgressBar bar = (ProgressBar) convertView.findViewById(R.id.ProgressBar);
|
||||
if(loadingList.get(position) == 1){
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
String itemDescr = getItemDescr(position);
|
||||
if (convertView.findViewById(R.id.descr) != null){
|
||||
((TextView)convertView.findViewById(R.id.descr)).setText(itemDescr);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,19 @@ import android.os.Environment;
|
|||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.NotificationCompat.Builder;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -44,6 +50,7 @@ import net.osmand.plus.AppInitializer.AppInitializeListener;
|
|||
import net.osmand.plus.AppInitializer.InitEvents;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.BusyIndicator;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.FirstUsageFragment;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -89,7 +96,9 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
/**
|
||||
* Called when the activity is first created.
|
||||
*/
|
||||
private OsmandMapTileView mapView;
|
||||
private AtlasMapRendererView atlasMapRendererView;
|
||||
|
||||
|
@ -119,6 +128,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
||||
private AppInitializeListener initListener;
|
||||
private IMapDownloaderCallback downloaderCallback;
|
||||
private DrawerLayout drawerLayout;
|
||||
|
||||
private Notification getNotification() {
|
||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||
|
@ -131,11 +141,11 @@ public class MapActivity extends AccessibleActivity {
|
|||
// pi);
|
||||
int smallIcon = app.getSettings().getApplicationMode().getSmallIconDark();
|
||||
final Builder noti = new NotificationCompat.Builder(
|
||||
this).setContentTitle(Version.getAppName(app))
|
||||
.setContentText(getString(R.string.go_back_to_osmand))
|
||||
.setSmallIcon(smallIcon )
|
||||
this).setContentTitle(Version.getAppName(app))
|
||||
.setContentText(getString(R.string.go_back_to_osmand))
|
||||
.setSmallIcon(smallIcon)
|
||||
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
|
||||
.setContentIntent(pi).setOngoing(true);
|
||||
.setContentIntent(pi).setOngoing(true);
|
||||
return noti.build();
|
||||
}
|
||||
|
||||
|
@ -208,16 +218,34 @@ public class MapActivity extends AccessibleActivity {
|
|||
OsmandPlugin.onMapActivityCreate(this);
|
||||
gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView());
|
||||
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");
|
||||
}
|
||||
mapView.refreshMap(true);
|
||||
|
||||
if(getMyApplication().getAppInitializer().isFirstTime(this)) {
|
||||
if (getMyApplication().getAppInitializer().isFirstTime(this)) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fragmentContainer, new FirstUsageFragment(),
|
||||
FirstUsageFragment.TAG).commit();
|
||||
}
|
||||
final ListView menuItemsListView = (ListView) findViewById(R.id.menuItems);
|
||||
menuItemsListView.setDivider(null);
|
||||
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() {
|
||||
|
@ -225,20 +253,21 @@ public class MapActivity extends AccessibleActivity {
|
|||
findViewById(R.id.init_progress).setVisibility(View.VISIBLE);
|
||||
initListener = new AppInitializeListener() {
|
||||
boolean openGlSetup = false;
|
||||
|
||||
@Override
|
||||
public void onProgress(AppInitializer init, InitEvents event) {
|
||||
String tn = init.getCurrentInitTaskName();
|
||||
if (tn != null) {
|
||||
((TextView) findViewById(R.id.ProgressMessage)).setText(tn);
|
||||
}
|
||||
if(event == InitEvents.NATIVE_INITIALIZED) {
|
||||
if (event == InitEvents.NATIVE_INITIALIZED) {
|
||||
setupOpenGLView(false);
|
||||
openGlSetup = true;
|
||||
}
|
||||
if(event == InitEvents.MAPS_INITIALIZED) {
|
||||
if (event == InitEvents.MAPS_INITIALIZED) {
|
||||
// TODO investigate if this false cause any issues!
|
||||
mapView.refreshMap(false);
|
||||
if(dashboardOnMap != null) {
|
||||
if (dashboardOnMap != null) {
|
||||
dashboardOnMap.updateLocation(true, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -246,11 +275,11 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
@Override
|
||||
public void onFinish(AppInitializer init) {
|
||||
if(!openGlSetup) {
|
||||
if (!openGlSetup) {
|
||||
setupOpenGLView(false);
|
||||
}
|
||||
mapView.refreshMap(false);
|
||||
if(dashboardOnMap != null) {
|
||||
if (dashboardOnMap != null) {
|
||||
dashboardOnMap.updateLocation(true, true, false);
|
||||
}
|
||||
findViewById(R.id.init_progress).setVisibility(View.GONE);
|
||||
|
@ -343,7 +372,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(dashboardOnMap.onBackPressed()) {
|
||||
if (dashboardOnMap.onBackPressed()) {
|
||||
return;
|
||||
}
|
||||
super.onBackPressed();
|
||||
|
@ -354,7 +383,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
super.onResume();
|
||||
long tm = System.currentTimeMillis();
|
||||
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {
|
||||
if(!dashboardOnMap.isVisible()) {
|
||||
if (!dashboardOnMap.isVisible()) {
|
||||
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +424,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||
if (routingHelper.isFollowingMode()
|
||||
&& (!Algorithms.objectEquals(targets.getPointToNavigate().point, routingHelper.getFinalLocation()) || !Algorithms
|
||||
.objectEquals(targets.getIntermediatePointsLatLon(), routingHelper.getIntermediatePoints()))) {
|
||||
.objectEquals(targets.getIntermediatePointsLatLon(), routingHelper.getIntermediatePoints()))) {
|
||||
targets.updateRouteAndReferesh(true);
|
||||
}
|
||||
app.getLocationProvider().resumeAllUpdates();
|
||||
|
@ -447,7 +476,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
atlasMapRendererView.handleOnResume();
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
@ -490,12 +519,12 @@ public class MapActivity extends AccessibleActivity {
|
|||
loc.setLatitude(mapView.getLatitude());
|
||||
loc.setLongitude(mapView.getLongitude());
|
||||
getMapActions().enterRoutePlanningMode(null, null, status == OsmandSettings.NAVIGATE_CURRENT_GPX);
|
||||
if(dashboardOnMap.isVisible()) {
|
||||
if (dashboardOnMap.isVisible()) {
|
||||
dashboardOnMap.hideDashboard();
|
||||
}
|
||||
}
|
||||
if (latLonToShow != null) {
|
||||
if(dashboardOnMap.isVisible()) {
|
||||
if (dashboardOnMap.isVisible()) {
|
||||
dashboardOnMap.hideDashboard();
|
||||
}
|
||||
if (mapLabelToShow != null) {
|
||||
|
@ -562,7 +591,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
AccessibleToast.makeText(this, R.string.edit_tilesource_maxzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
if(newZoom < 1) {
|
||||
if (newZoom < 1) {
|
||||
AccessibleToast.makeText(this, R.string.edit_tilesource_minzoom, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
@ -596,7 +625,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
LatLon loc = getMapLocation();
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
||||
if(mapViewTrackingUtilities.isMapLinkedToLocation()) {
|
||||
if (mapViewTrackingUtilities.isMapLinkedToLocation()) {
|
||||
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
||||
}
|
||||
startActivity(newIntent);
|
||||
|
@ -639,7 +668,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
return super.onTrackballEvent(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
@ -690,14 +719,14 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
|
||||
public LatLon getMapLocation() {
|
||||
if(mapView == null) {
|
||||
if (mapView == null) {
|
||||
return settings.getLastKnownMapLocation();
|
||||
}
|
||||
return new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||
}
|
||||
|
||||
|
||||
public float getMapRotate() {
|
||||
if(mapView == null) {
|
||||
if (mapView == null) {
|
||||
return 0;
|
||||
}
|
||||
return mapView.getRotate();
|
||||
|
@ -758,7 +787,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
|
||||
public void updateMapSettings() {
|
||||
if(app.isApplicationInitializing()) {
|
||||
if (app.isApplicationInitializing()) {
|
||||
return;
|
||||
}
|
||||
// update vector renderer
|
||||
|
@ -781,9 +810,13 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
protected void onPostExecute(Void result) {};
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
}
|
||||
|
||||
;
|
||||
}.execute((Void) null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -821,7 +854,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
|
||||
public void checkExternalStorage() {
|
||||
if(Build.VERSION.SDK_INT >= 19) {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
return;
|
||||
}
|
||||
String state = Environment.getExternalStorageState();
|
||||
|
@ -911,7 +944,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
OsmandPlugin.onMapActivityResult(requestCode, resultCode, data);
|
||||
MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
|
||||
if(mcl != null) {
|
||||
if (mcl != null) {
|
||||
mcl.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
@ -927,4 +960,20 @@ public class MapActivity extends AccessibleActivity {
|
|||
public DashboardOnMap getDashboard() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -543,7 +543,24 @@ public class MapActivityActions implements DialogProvider {
|
|||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
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)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
|
@ -557,15 +574,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
return true;
|
||||
}
|
||||
}).reg();
|
||||
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||
optionsMenuHelper.item(R.string.search_button)
|
||||
.iconColor(R.drawable.ic_action_search_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -239,8 +240,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
flat.setVisibility(View.GONE);
|
||||
ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
|
||||
settingsButton.setVisibility(View.GONE);
|
||||
ImageView configureScreen = (ImageView) dashboardView.findViewById(R.id.toolbar_configure_screen);
|
||||
configureScreen.setVisibility(View.GONE);
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
|
||||
lst.setVisibility(View.GONE);
|
||||
|
@ -302,15 +301,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
});
|
||||
}
|
||||
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.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
@ -321,19 +311,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
}
|
||||
});
|
||||
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() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (visibleType == DashboardType.DASHBOARD) {
|
||||
setDashboardVisibility(true, DashboardType.LIST_MENU, null, true);
|
||||
} else {
|
||||
setDashboardVisibility(true, DashboardType.DASHBOARD, null, true);
|
||||
}
|
||||
hideDashboard(false);
|
||||
mapActivity.openDrawer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -441,12 +424,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
this.visibleType = type;
|
||||
DashboardOnMap.staticVisible = visible;
|
||||
DashboardOnMap.staticVisibleType = type;
|
||||
mapActivity.enableDrawer();
|
||||
if (visible) {
|
||||
mapViewLocation = mapActivity.getMapLocation();
|
||||
mapRotation = mapActivity.getMapRotate();
|
||||
mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||
myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
mapActivity.getMapViewTrackingUtilities().setDashboard(this);
|
||||
mapActivity.disableDrawer();
|
||||
dashboardView.setVisibility(View.VISIBLE);
|
||||
if (isActionButtonVisible()) {
|
||||
actionButton.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -385,7 +385,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
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);
|
||||
controls.add(menuControl);
|
||||
backToMenuButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -395,7 +395,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
// double lon = activity.getMapView().getLongitude();
|
||||
// MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon));
|
||||
notifyClicked();
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
||||
mapActivity.openDrawer();
|
||||
// mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
||||
}
|
||||
});
|
||||
mapAppModeShadow = mapActivity.findViewById(R.id.map_app_mode_shadow);
|
||||
|
|
Loading…
Reference in a new issue