Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8532714042
18 changed files with 244 additions and 92 deletions
|
@ -5,11 +5,4 @@
|
|||
android:id="@+id/main_scroll"
|
||||
android:background="@color/dashboard_background" >
|
||||
|
||||
<fragment
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="net.osmand.plus.dashboard.DashAudioVideoNotesFragment"
|
||||
android:layout_marginTop="@dimen/dashCardMargin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</ScrollView>
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout android:id="@+id/header"
|
||||
<LinearLayout android:id="@+id/header_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:background="@drawable/dashboard_button"
|
||||
android:layout_height="@dimen/dashListItemHeight">
|
||||
<View android:layout_width="match_parent"
|
||||
android:id="@+id/divider"
|
||||
android:background="@color/dashboard_divider"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_marginTop="0dp"
|
||||
android:autoLink="web"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"></TextView>
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -22,6 +22,23 @@
|
|||
android:selectAllOnFocus="true" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_description" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/descr"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:completionThreshold="1"
|
||||
android:inputType="textCapWords"
|
||||
android:paddingLeft="3dp"
|
||||
android:selectAllOnFocus="true" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp">
|
||||
android:paddingLeft="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -30,7 +30,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
style="@style/ListText.Small"></TextView>
|
||||
style="@style/ListText.Small"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_index_size"
|
||||
|
@ -38,7 +38,7 @@
|
|||
android:gravity="right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ListText.Small"></TextView>
|
||||
style="@style/ListText.Small"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
@ -47,6 +47,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="25"
|
||||
style="@style/ListText.Small"></TextView>
|
||||
style="@style/ListText.Small"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -7,6 +7,7 @@ import android.content.Context;
|
|||
public class FavouritePoint implements Serializable, LocationPoint {
|
||||
private static final long serialVersionUID = 729654300829771466L;
|
||||
private String name;
|
||||
private String description;
|
||||
private String category = "";
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
|
@ -75,6 +76,14 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription () {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -344,6 +344,7 @@ public class FavouritesDbHelper {
|
|||
pt.setColor(p.getColor());
|
||||
}
|
||||
pt.name = p.getName();
|
||||
pt.desc = p.getDescription();
|
||||
if (p.getCategory().length() > 0)
|
||||
pt.category = p.getCategory();
|
||||
gpx.points.add(pt);
|
||||
|
@ -432,6 +433,7 @@ public class FavouritesDbHelper {
|
|||
name = p.name.substring(0, c);
|
||||
}
|
||||
FavouritePoint fp = new FavouritePoint(p.lat, p.lon, name, categoryName);
|
||||
fp.setDescription(p.desc);
|
||||
fp.setColor(p.getColor(0));
|
||||
fp.setVisible(!p.getExtensionsToRead().containsKey(HIDDEN));
|
||||
points.put(getKey(fp), fp);
|
||||
|
|
|
@ -211,7 +211,7 @@ public class OsmandApplication extends Application {
|
|||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
if (routingHelper != null) {
|
||||
routingHelper.getVoiceRouter().onApplicationTerminate(this);
|
||||
routingHelper.getVoiceRouter().onApplicationTerminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -951,6 +951,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if(getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
|
||||
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
|
||||
}
|
||||
routingHelper.getVoiceRouter().interruptRouteCommands();
|
||||
routingHelper.clearCurrentRoute(null, new ArrayList<LatLon>());
|
||||
routingHelper.setRoutePlanningMode(false);
|
||||
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
|
||||
|
|
|
@ -1019,8 +1019,10 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
recordings.unregisterObject(r.lat, r.lon, r);
|
||||
recordingByFileName.remove(r.file.getName());
|
||||
Algorithms.removeAllFiles(r.file);
|
||||
activity.getMapLayers().getContextMenuLayer().setLocation(null, "");
|
||||
activity.getMapView().refreshMap();
|
||||
if (activity != null) {
|
||||
activity.getMapLayers().getContextMenuLayer().setLocation(null, "");
|
||||
activity.getMapView().refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,22 +1,45 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.internal.widget.IcsAdapterView;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MainMenuActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis on 23.12.2014.
|
||||
*/
|
||||
public class DashAudioVideoNotesActivity extends SherlockFragmentActivity {
|
||||
public class DashAudioVideoNotesActivity extends SherlockListActivity {
|
||||
AudioVideoNotesPlugin plugin;
|
||||
List<AudioVideoNotesPlugin.Recording> items;
|
||||
NotesAdapter listAdapter;
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setContentView(R.layout.audio_video_notes_all);
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.editing_poi_filter);
|
||||
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
|
||||
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
@ -24,6 +47,53 @@ public class DashAudioVideoNotesActivity extends SherlockFragmentActivity {
|
|||
actionBar.setBackgroundDrawable(color);
|
||||
actionBar.setIcon(android.R.color.transparent);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
getListView().setBackgroundColor(getResources().getColor(R.color.dashboard_background));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
items = new ArrayList<AudioVideoNotesPlugin.Recording>(plugin.getAllRecordings());
|
||||
listAdapter = new NotesAdapter(items);
|
||||
setListAdapter(listAdapter);
|
||||
}
|
||||
|
||||
private void showContextMenu(final AudioVideoNotesPlugin.Recording recording){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(this);
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.local_index_mi_delete) {
|
||||
AlertDialog.Builder confirm = new AlertDialog.Builder(DashAudioVideoNotesActivity.this);
|
||||
confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
plugin.deleteRecording(recording);
|
||||
items.remove(recording);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
confirm.setNegativeButton(R.string.default_buttons_no, null);
|
||||
confirm.setMessage(getString(R.string.delete_confirmation_msg, recording.file.getName()));
|
||||
confirm.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
adapter.item(R.string.local_index_mi_delete).listen(listener).position(0).reg();
|
||||
|
||||
builder.setItems(adapter.getItemNames(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
ContextMenuAdapter.OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||
if (clk != null){
|
||||
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,4 +105,32 @@ public class DashAudioVideoNotesActivity extends SherlockFragmentActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
||||
NotesAdapter(List<AudioVideoNotesPlugin.Recording> recordingList) {
|
||||
super(DashAudioVideoNotesActivity.this, R.layout.dash_note_item, recordingList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View row = convertView;
|
||||
if (row == null){
|
||||
row = inflater.inflate(R.layout.dash_note_item, parent, false);
|
||||
row.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
}
|
||||
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
||||
DashAudioVideoNotesFragment.getNoteView(recording, row, DashAudioVideoNotesActivity.this, plugin);
|
||||
row.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
showContextMenu(recording);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
|
@ -28,32 +29,25 @@ import java.util.List;
|
|||
*/
|
||||
public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
||||
AudioVideoNotesPlugin plugin;
|
||||
boolean allNotes;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
|
||||
allNotes = getActivity() instanceof DashAudioVideoNotesActivity;
|
||||
if (allNotes) {
|
||||
view.findViewById(R.id.header).setVisibility(View.GONE);
|
||||
} else {
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
final Intent favorites = new Intent(activity, DashAudioVideoNotesActivity.class);
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
});
|
||||
}
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
final Intent favorites = new Intent(activity, DashAudioVideoNotesActivity.class);
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -78,21 +72,21 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
}
|
||||
|
||||
if (plugin == null){
|
||||
(mainView.findViewById(R.id.main_notes)).setVisibility(View.GONE);
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
List<AudioVideoNotesPlugin.Recording> notes = new ArrayList<AudioVideoNotesPlugin.Recording>(plugin.getAllRecordings());
|
||||
if (notes.size() == 0){
|
||||
(mainView.findViewById(R.id.main_notes)).setVisibility(View.GONE);
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
(mainView.findViewById(R.id.main_notes)).setVisibility(View.VISIBLE);
|
||||
mainView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.notes);
|
||||
notesLayout.removeAllViews();
|
||||
if (notes.size() > 3 && !allNotes){
|
||||
if (notes.size() > 3){
|
||||
while (notes.size() != 3){
|
||||
notes.remove(3);
|
||||
}
|
||||
|
@ -102,23 +96,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.dash_note_item, null, false);
|
||||
|
||||
if (recording.name != null){
|
||||
((TextView) view.findViewById(R.id.name)).setText(recording.name);
|
||||
((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
||||
} else {
|
||||
((TextView) view.findViewById(R.id.name)).setText(recording.getDescription(getActivity()));
|
||||
view.findViewById(R.id.descr).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||
if (recording.isAudio()){
|
||||
icon.setImageResource(R.drawable.ic_type_audio);
|
||||
} else if (recording.isVideo()){
|
||||
icon.setImageResource(R.drawable.ic_type_video);
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.ic_type_img);
|
||||
}
|
||||
|
||||
getNoteView(recording, view, getActivity(), plugin);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -128,20 +106,35 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
plugin.playRecording(getActivity(), recording);
|
||||
}
|
||||
});
|
||||
|
||||
//int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());
|
||||
|
||||
//LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
|
||||
//view.setLayoutParams(lp);
|
||||
notesLayout.addView(view);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
|
||||
final Context ctx, final AudioVideoNotesPlugin plugin) {
|
||||
if (recording.name != null){
|
||||
((TextView) view.findViewById(R.id.name)).setText(recording.name);
|
||||
((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(ctx));
|
||||
} else {
|
||||
((TextView) view.findViewById(R.id.name)).setText(recording.getDescription(ctx));
|
||||
view.findViewById(R.id.descr).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||
if (recording.isAudio()){
|
||||
icon.setImageResource(R.drawable.ic_type_audio);
|
||||
} else if (recording.isVideo()){
|
||||
icon.setImageResource(R.drawable.ic_type_video);
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.ic_type_img);
|
||||
}
|
||||
|
||||
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
plugin.playRecording(ctx, recording);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.*;
|
||||
import android.widget.ImageView;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MainMenuActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.render.MapRenderRepositories;
|
||||
import net.osmand.plus.render.MapVectorLayer;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.views.MapTextLayer;
|
||||
|
@ -17,9 +22,6 @@ import net.osmand.plus.views.OsmandMapTileView;
|
|||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
@ -27,7 +29,7 @@ import android.widget.TextView;
|
|||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
*/
|
||||
public class DashMapFragment extends DashBaseFragment implements IMapDownloaderCallback {
|
||||
public class DashMapFragment extends DashBaseFragment implements IMapDownloaderCallback {
|
||||
|
||||
public static final String TAG = "DASH_MAP_FRAGMENT";
|
||||
|
||||
|
@ -36,7 +38,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
super.onDestroy();
|
||||
getMyApplication().getResourceManager().getMapTileDownloader().removeDownloaderCallback(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -46,7 +48,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
protected void startMapActivity() {
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_map_fragment, container, false);
|
||||
|
@ -60,7 +62,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
startMapActivity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
view.findViewById(R.id.map_image).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -68,7 +70,6 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
startMapActivity();
|
||||
}
|
||||
});
|
||||
setMapImage(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
}
|
||||
Bitmap image = getMyApplication().getResourceManager().getRenderer().getBitmap();
|
||||
ImageView map = (ImageView) view.findViewById(R.id.map_image);
|
||||
if (image != null){
|
||||
if (image != null) {
|
||||
map.setImageBitmap(image);
|
||||
}
|
||||
}
|
||||
|
@ -88,15 +89,16 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setMapImage(getView());
|
||||
|
||||
if (!getMyApplication().isApplicationInitializing()) {
|
||||
updateMapImage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
view.findViewById(R.id.map_image).setVisibility(View.GONE);
|
||||
if(getMyApplication().isApplicationInitializing()) {
|
||||
if (getMyApplication().isApplicationInitializing()) {
|
||||
getMyApplication().checkApplicationIsBeingInitialized(getActivity(), (TextView) view.findViewById(R.id.ProgressMessage),
|
||||
(ProgressBar) view.findViewById(R.id.ProgressBar), new Runnable() {
|
||||
@Override
|
||||
|
@ -110,9 +112,10 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
}
|
||||
|
||||
private void applicationInitialized(View view) {
|
||||
updateMapImage();
|
||||
view.findViewById(R.id.loading).setVisibility(View.GONE);
|
||||
MainMenuActivity dashboardActivity =((MainMenuActivity)getSherlockActivity());
|
||||
if (dashboardActivity != null){
|
||||
MainMenuActivity dashboardActivity = ((MainMenuActivity) getSherlockActivity());
|
||||
if (dashboardActivity != null) {
|
||||
dashboardActivity.updateDownloads();
|
||||
view.findViewById(R.id.map_image).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -120,10 +123,27 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
|
||||
@Override
|
||||
public void tileDownloaded(DownloadRequest request) {
|
||||
if(request != null && !request.error && request.fileToSave != null){
|
||||
if (request != null && !request.error && request.fileToSave != null) {
|
||||
ResourceManager mgr = getMyApplication().getResourceManager();
|
||||
mgr.tileDownloaded(request);
|
||||
setMapImage(getView());
|
||||
}
|
||||
setMapImage(getView());
|
||||
}
|
||||
|
||||
private void updateMapImage() {
|
||||
MapRenderRepositories repositories = getMyApplication().getResourceManager().getRenderer();
|
||||
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
|
||||
|
||||
WindowManager wm = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = wm.getDefaultDisplay();
|
||||
int height = (int) getActivity().getResources().getDimension(R.dimen.dashMapHeight);
|
||||
int width = display.getWidth();
|
||||
|
||||
RotatedTileBox rotatedTileBox = new RotatedTileBox.RotatedTileBoxBuilder().
|
||||
setZoom(zm).setLocation(lm.getLatitude(), lm.getLongitude()).
|
||||
setPixelDimensions(width, height).build();
|
||||
repositories.loadMap(rotatedTileBox,
|
||||
getMyApplication().getResourceManager().getMapTileDownloader().getDownloaderCallbacks());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ public class FavoriteDialogs {
|
|||
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
|
||||
builder.setView(v);
|
||||
final EditText editText = (EditText) v.findViewById(R.id.Name);
|
||||
final EditText description = (EditText) v.findViewById(R.id.descr);
|
||||
final AutoCompleteTextView cat = (AutoCompleteTextView) v.findViewById(R.id.Category);
|
||||
List<FavoriteGroup> gs = helper.getFavoriteGroups();
|
||||
String[] list = new String[gs.size()];
|
||||
|
@ -208,6 +209,7 @@ public class FavoriteDialogs {
|
|||
final FavouritesDbHelper helper = app.getFavorites();
|
||||
app.getSettings().LAST_FAV_CATEGORY_ENTERED.set(categoryStr);
|
||||
point.setName(editText.getText().toString().trim());
|
||||
point.setDescription(description.getText().toString().trim());
|
||||
point.setCategory(categoryStr);
|
||||
boolean added = helper.addFavourite(point);
|
||||
if (added) {
|
||||
|
|
|
@ -484,7 +484,17 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
if (type == WaypointHelper.POI && btn.isChecked()){
|
||||
running[0] = position;
|
||||
thisAdapter.notifyDataSetInvalidated();
|
||||
selectPoi(running, thisAdapter, type, true, ctx);
|
||||
MapActivity map = (MapActivity) ctx;
|
||||
final PoiFilter[] selected = new PoiFilter[1];
|
||||
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
||||
dlg.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
if (selected != null) {
|
||||
enableType(running, thisAdapter, type, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -493,7 +503,8 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
|
||||
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
||||
final boolean enable, Activity ctx) {
|
||||
if (ctx instanceof MapActivity && !PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
||||
if (ctx instanceof MapActivity &&
|
||||
!PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
||||
MapActivity map = (MapActivity) ctx;
|
||||
final PoiFilter[] selected = new PoiFilter[1];
|
||||
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
||||
|
|
|
@ -793,7 +793,7 @@ public class VoiceRouter {
|
|||
// }
|
||||
//}
|
||||
|
||||
public void onApplicationTerminate(Context ctx) {
|
||||
public void onApplicationTerminate() {
|
||||
if (player != null) {
|
||||
player.clear();
|
||||
}
|
||||
|
|
|
@ -165,7 +165,10 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
public String getObjectDescription(Object o) {
|
||||
Class<? extends LocationPoint> fcl = getFavoriteClass();
|
||||
if(o!= null && fcl.isInstance(o)) {
|
||||
return getObjName() + " : " + ((LocationPoint)o).getName(view.getContext()); //$NON-NLS-1$
|
||||
String desciption = ((FavouritePoint)o).getDescription() != null ?
|
||||
" " + ((FavouritePoint)o).getDescription() : "";
|
||||
return getObjName() + ": " + ((LocationPoint)o).getName(view.getContext())
|
||||
+ desciption; //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue