Added skip dialog to first usage screen
This commit is contained in:
parent
864120e6ad
commit
275e021ce0
2 changed files with 29 additions and 6 deletions
|
@ -11,6 +11,8 @@
|
|||
-->
|
||||
|
||||
<!-- Not translatable -->
|
||||
<string name="skip_map_downloading">Skip map downloading</string>
|
||||
<string name="skip_map_downloading_desc">You do not have any offline map installed. You may choose map from the list or download it later via Menu - %1$s.</string>
|
||||
<string name="search_another_country">Search for another country</string>
|
||||
<string name="search_map">Searching map…</string>
|
||||
<string name="first_usage_wizard_desc">We would like to determine your location and suggest to download map of this region.</string>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.firstusage;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -9,6 +10,7 @@ import android.support.annotation.Nullable;
|
|||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -82,6 +84,7 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
|
|||
private static IndexItem baseMapIndexItem;
|
||||
private static boolean firstMapDownloadCancelled;
|
||||
private static boolean secondMapDownloadCancelled;
|
||||
private static boolean wizardClosed;
|
||||
|
||||
enum WizardType {
|
||||
SEARCH_LOCATION,
|
||||
|
@ -119,10 +122,25 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
|
|||
skipButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// todo show dialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(getString(R.string.skip_map_downloading));
|
||||
builder.setMessage(getString(R.string.skip_map_downloading_desc, getString(R.string.index_settings)));
|
||||
builder.setNegativeButton(R.string.shared_string_skip, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
closeWizard();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(R.string.shared_string_cancel, null);
|
||||
builder.setPositiveButton(R.string.shared_string_select, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
searchCountryMap();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
});
|
||||
|
||||
view.findViewById(R.id.action_button).setVisibility(View.GONE);
|
||||
|
||||
|
@ -552,6 +570,7 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
|
|||
location = null;
|
||||
localMapIndexItem = null;
|
||||
baseMapIndexItem = null;
|
||||
wizardClosed = true;
|
||||
}
|
||||
|
||||
public void processLocationPermission(boolean granted) {
|
||||
|
@ -704,11 +723,13 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
|
|||
}
|
||||
|
||||
private static void showFragment(FragmentActivity activity, Fragment fragment) {
|
||||
if (!wizardClosed) {
|
||||
activity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, fragment, FirstUsageWizardFragment.TAG)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
|
|
Loading…
Reference in a new issue