Merge pull request #10268 from osmandapp/save_track_share_btn
Plan route share button
This commit is contained in:
commit
25026272f8
1 changed files with 53 additions and 19 deletions
|
@ -2,6 +2,7 @@ package net.osmand.plus.measurementtool;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
@ -10,6 +11,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -19,9 +21,10 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
|||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemButton;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SavedTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public static final String TAG = SavedTrackBottomSheetDialogFragment.class.getSimpleName();
|
||||
|
@ -68,27 +71,58 @@ public class SavedTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFr
|
|||
}
|
||||
})
|
||||
.create());
|
||||
}
|
||||
|
||||
items.add(new DividerSpaceItem(getContext(), contextPaddingSmall));
|
||||
@Override
|
||||
protected int getThirdBottomButtonTextId() {
|
||||
return R.string.shared_string_share;
|
||||
}
|
||||
|
||||
items.add(new BottomSheetItemButton.Builder()
|
||||
.setButtonType(UiUtilities.DialogButtonType.SECONDARY)
|
||||
.setTitle(getString(R.string.plan_route_create_new_route))
|
||||
.setLayoutId(R.layout.bottom_sheet_button)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof MapActivity) {
|
||||
MeasurementToolFragment.showInstance(((MapActivity) activity).getSupportFragmentManager(),
|
||||
((MapActivity) activity).getMapLocation());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
})
|
||||
.create());
|
||||
@Override
|
||||
protected void onThirdBottomButtonClick() {
|
||||
final Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
final Uri fileUri = AndroidUtils.getUriForFile(getMyApplication(), new File(fileName));
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||
sendIntent.setType("application/gpx+xml");
|
||||
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
startActivity(sendIntent);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
items.add(new DividerSpaceItem(getContext(), contextPaddingSmall));
|
||||
@Override
|
||||
protected UiUtilities.DialogButtonType getThirdBottomButtonType() {
|
||||
return UiUtilities.DialogButtonType.SECONDARY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSecondDividerHeight() {
|
||||
return getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightBottomButtonTextId() {
|
||||
return R.string.plan_route_create_new_route;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UiUtilities.DialogButtonType getRightBottomButtonType() {
|
||||
return UiUtilities.DialogButtonType.SECONDARY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRightBottomButtonClick() {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof MapActivity) {
|
||||
MeasurementToolFragment.showInstance(((MapActivity) activity).getSupportFragmentManager(),
|
||||
((MapActivity) activity).getMapLocation());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getFirstDividerHeight() {
|
||||
return getResources().getDimensionPixelSize(R.dimen.context_menu_sub_info_height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue