// Path: src/main/java/com/androzic/waypoint/CoordinatesReceived.java
// public class CoordinatesReceived extends DialogFragment
// {
//     private double lat, lon;
// 
// 	@NonNull
// 	@SuppressLint("InflateParams")
// 	@Override
// 	public Dialog onCreateDialog(Bundle savedInstanceState)
// 	{
// 		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// 		builder.setTitle(getString(R.string.information_name));
// 		View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_coordinates_received, null);
// 		builder.setView(view);
// 		builder.setPositiveButton(R.string.menu_visible, new DialogInterface.OnClickListener() {
// 			public void onClick(DialogInterface dialog, int whichButton)
// 			{
// 				Androzic application = Androzic.getApplication();
// 				application.ensureVisible(lat, lon);
// 				CoordinatesReceived.this.dismiss();
// 			}
// 		});
// 
// 		Bundle args = getArguments();
// 
// 		String title = args.getString("title");
// 		String sender = args.getString("sender");
// 		lat = args.getDouble("lat");
// 		lon = args.getDouble("lon");
// 
// 		if (! "".equals(title))
// 			builder.setTitle(title);
// 		else
// 			builder.setTitle(R.string.coordinates_name);
// 
// 		Androzic application = Androzic.getApplication();
// 		double[] ll = application.getLocation();
// 
// 		((TextView) view.findViewById(R.id.message)).setText(getString(R.string.new_coordinates, sender));
// 
// 		String coords = StringFormatter.coordinates(" ", lat, lon);
// 		((TextView) view.findViewById(R.id.coordinates)).setText(coords);
// 
// 		double dist = Geo.distance(ll[0], ll[1], lat, lon);
// 		double bearing = Geo.bearing(ll[0], ll[1], lat, lon);
// 		bearing = application.fixDeclination(bearing);
// 		String distance = StringFormatter.distanceH(dist)+" "+StringFormatter.angleH(bearing);
// 		((TextView) view.findViewById(R.id.distance)).setText(distance);
// 
// 		return builder.create();
// 	}
// }


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.androzic.waypoint.CoordinatesReceived;
/*
 * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3).
 * Copyright (C) 2010-2012  Andrey Novikov <http://andreynovikov.info/>
 *
 * This file is part of Androzic application.
 *
 * Androzic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Androzic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with Androzic.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.androzic;



public class ActionsReceiver extends BroadcastReceiver
{
	private static final String TAG = "ActionsReceiver";
	
	@Override
	public void onReceive(Context context, Intent intent)
	{
		String action = intent.getAction();
		Log.i(TAG, "Action received: " + action);

		Intent activity = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);

		if (action.equals("com.androzic.COORDINATES_RECEIVED"))
		{
			activity.putExtras(intent);
// Path: src/main/java/com/androzic/waypoint/CoordinatesReceived.java
// public class CoordinatesReceived extends DialogFragment
// {
//     private double lat, lon;
// 
// 	@NonNull
// 	@SuppressLint("InflateParams")
// 	@Override
// 	public Dialog onCreateDialog(Bundle savedInstanceState)
// 	{
// 		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// 		builder.setTitle(getString(R.string.information_name));
// 		View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_coordinates_received, null);
// 		builder.setView(view);
// 		builder.setPositiveButton(R.string.menu_visible, new DialogInterface.OnClickListener() {
// 			public void onClick(DialogInterface dialog, int whichButton)
// 			{
// 				Androzic application = Androzic.getApplication();
// 				application.ensureVisible(lat, lon);
// 				CoordinatesReceived.this.dismiss();
// 			}
// 		});
// 
// 		Bundle args = getArguments();
// 
// 		String title = args.getString("title");
// 		String sender = args.getString("sender");
// 		lat = args.getDouble("lat");
// 		lon = args.getDouble("lon");
// 
// 		if (! "".equals(title))
// 			builder.setTitle(title);
// 		else
// 			builder.setTitle(R.string.coordinates_name);
// 
// 		Androzic application = Androzic.getApplication();
// 		double[] ll = application.getLocation();
// 
// 		((TextView) view.findViewById(R.id.message)).setText(getString(R.string.new_coordinates, sender));
// 
// 		String coords = StringFormatter.coordinates(" ", lat, lon);
// 		((TextView) view.findViewById(R.id.coordinates)).setText(coords);
// 
// 		double dist = Geo.distance(ll[0], ll[1], lat, lon);
// 		double bearing = Geo.bearing(ll[0], ll[1], lat, lon);
// 		bearing = application.fixDeclination(bearing);
// 		String distance = StringFormatter.distanceH(dist)+" "+StringFormatter.angleH(bearing);
// 		((TextView) view.findViewById(R.id.distance)).setText(distance);
// 
// 		return builder.create();
// 	}
// }


// Path: src/main/java/com/androzic/ActionsReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.androzic.waypoint.CoordinatesReceived;

/*
 * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3).
 * Copyright (C) 2010-2012  Andrey Novikov <http://andreynovikov.info/>
 *
 * This file is part of Androzic application.
 *
 * Androzic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Androzic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with Androzic.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.androzic;



public class ActionsReceiver extends BroadcastReceiver
{
	private static final String TAG = "ActionsReceiver";
	
	@Override
	public void onReceive(Context context, Intent intent)
	{
		String action = intent.getAction();
		Log.i(TAG, "Action received: " + action);

		Intent activity = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);

		if (action.equals("com.androzic.COORDINATES_RECEIVED"))
		{
			activity.putExtras(intent);
			activity.putExtra(MainActivity.SHOW_FRAGMENT, CoordinatesReceived.class);