Added wptpt parametr for waypoint reached dialog
This commit is contained in:
parent
840b46f576
commit
d5d654ff25
4 changed files with 60 additions and 75 deletions
|
@ -1,54 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/package_delivered_layout"
|
android:id="@+id/package_delivered_layout"
|
||||||
android:background="@color/color_black">
|
android:background="@color/color_black"
|
||||||
|
android:weightSum="1">
|
||||||
|
|
||||||
<TextView android:id="@+id/point_name"
|
<ImageView android:layout_marginLeft="8dp"
|
||||||
|
android:src="@drawable/list_favorite"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/waypoint_text"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_marginLeft="8dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:layout_marginBottom="2dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<TextView android:id="@+id/point_id"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<LinearLayout android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<TextView android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:layout_marginRight="10dp"
|
|
||||||
android:singleLine="false"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:text="@string/waypoint_reached_msg"/>
|
android:text="@string/waypoint_reached_msg"/>
|
||||||
<LinearLayout android:orientation="horizontal"
|
|
||||||
android:layout_gravity="center_horizontal"
|
<Button android:id="@+id/info_close"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<Button android:id="@+id/info_yes"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="4dp"
|
||||||
android:text="@string/default_buttons_yes"/>
|
android:text="@string/close"/>
|
||||||
<Button android:id="@+id/info_no"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:text="@string/default_buttons_no"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -41,5 +41,5 @@
|
||||||
<string name="start_tour">Start tour</string>
|
<string name="start_tour">Start tour</string>
|
||||||
<string name="download_tour">Download tour</string>
|
<string name="download_tour">Download tour</string>
|
||||||
<string name="sherpafy_app_name">Sherpafy</string>
|
<string name="sherpafy_app_name">Sherpafy</string>
|
||||||
<string name="waypoint_reached_msg">Do you want to see waypoint information?</string>
|
<string name="waypoint_reached_msg">See waypoint information</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -78,6 +78,8 @@ public class RoutingHelper {
|
||||||
|
|
||||||
private RouteCalculationProgressCallback progressRoute;
|
private RouteCalculationProgressCallback progressRoute;
|
||||||
|
|
||||||
|
WaypointDialogHelper dialogHelper;
|
||||||
|
|
||||||
// private ProgressBar progress;
|
// private ProgressBar progress;
|
||||||
// private Handler progressHandler;
|
// private Handler progressHandler;
|
||||||
|
|
||||||
|
@ -89,6 +91,7 @@ public class RoutingHelper {
|
||||||
this.app = context;
|
this.app = context;
|
||||||
settings = context.getSettings();
|
settings = context.getSettings();
|
||||||
voiceRouter = new VoiceRouter(this, settings, player);
|
voiceRouter = new VoiceRouter(this, settings, player);
|
||||||
|
dialogHelper = new WaypointDialogHelper(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFollowingMode() {
|
public boolean isFollowingMode() {
|
||||||
|
@ -329,8 +332,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
if(!Algorithms.isEmpty(s)) {
|
if(!Algorithms.isEmpty(s)) {
|
||||||
voiceRouter.announceWaypoint(s);
|
voiceRouter.announceWaypoint(s);
|
||||||
WaypointDialogHelper dialogHelper = new WaypointDialogHelper(app);
|
dialogHelper.addDialogWithShift(wpt.get(0));
|
||||||
dialogHelper.addDialogWithShift();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,18 @@
|
||||||
package net.osmand.plus.sherpafy;
|
package net.osmand.plus.sherpafy;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.widget.*;
|
||||||
import android.widget.Button;
|
import net.osmand.plus.GPXUtilities;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.api.render.Paint;
|
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
|
||||||
import net.osmand.plus.views.controls.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis on 25.07.2014.
|
* Created by Denis on 25.07.2014.
|
||||||
|
@ -38,7 +32,7 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDialogWithShift() {
|
public void addDialogWithShift(GPXUtilities.WptPt point) {
|
||||||
//if map activity is null - try to get it from app again
|
//if map activity is null - try to get it from app again
|
||||||
if (mapActivity == null){
|
if (mapActivity == null){
|
||||||
mapActivity = app.mapActivity;
|
mapActivity = app.mapActivity;
|
||||||
|
@ -55,23 +49,38 @@ public class WaypointDialogHelper {
|
||||||
final LayoutInflater vi = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
final LayoutInflater vi = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
View reachedView = vi.inflate(R.layout.waypoint_reached, null);
|
View reachedView = vi.inflate(R.layout.waypoint_reached, null);
|
||||||
|
|
||||||
Button btnY = (Button) reachedView.findViewById(R.id.info_yes);
|
TextView text = (TextView) reachedView.findViewById(R.id.waypoint_text);
|
||||||
btnY.setOnClickListener(new View.OnClickListener() {
|
text.setText(point != null ? point.name : "Point");
|
||||||
|
text.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//call your activity here
|
final Intent favorites = new Intent(mapActivity, app.getAppCustomization().getFavoritesActivity());
|
||||||
|
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
mapActivity.startActivity(favorites);
|
||||||
|
removeDialog(view);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button btnN = (Button) reachedView.findViewById(R.id.info_no);
|
Button btnN = (Button) reachedView.findViewById(R.id.info_close);
|
||||||
btnN.setOnClickListener(new View.OnClickListener() {
|
btnN.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View child) {
|
public void onClick(View view) {
|
||||||
|
removeDialog(view);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (reachedView != null && mainLayout != null) {
|
||||||
|
mainLayout.addView(reachedView, params);
|
||||||
|
waitBeforeLayoutIsResized(reachedView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeDialog(View child){
|
||||||
if (child == null || child.getParent() == null) {
|
if (child == null || child.getParent() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
View parent = (View) child.getParent().getParent().getParent();
|
View parent = (View) child.getParent();
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -83,13 +92,6 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (reachedView != null && mainLayout != null) {
|
|
||||||
mainLayout.addView(reachedView, params);
|
|
||||||
waitBeforeLayoutIsResized(reachedView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkIfDialogExists() {
|
private boolean checkIfDialogExists() {
|
||||||
if (mainLayout == null){
|
if (mainLayout == null){
|
||||||
|
|
Loading…
Reference in a new issue