Added select country button to first usage screen

This commit is contained in:
Alexey Kulish 2016-08-17 18:15:27 +03:00
parent eb890bc798
commit 0fe2e9d6df
3 changed files with 31 additions and 1 deletions

View file

@ -11,6 +11,7 @@
-->
<!-- Not translatable -->
<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>
<string name="location_not_found">Location not found</string>

View file

@ -403,7 +403,7 @@
android:id="@+id/map_download_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="24dp"
@ -481,6 +481,19 @@
</android.support.v7.widget.CardView>
<android.support.v7.widget.AppCompatButton
android:id="@+id/search_country_button"
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_gravity="center"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:visibility="gone"
android:text="@string/search_another_country"
android:textColor="@color/color_dialog_buttons_light"/>
<android.support.v7.widget.CardView
android:id="@+id/map_downloading_card"
android:layout_width="match_parent"

View file

@ -1,6 +1,7 @@
package net.osmand.plus.firstusage;
import android.Manifest;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StatFs;
@ -174,6 +175,14 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
}
});
view.findViewById(R.id.map_download_card).setVisibility(View.VISIBLE);
final AppCompatButton searchCountryButton = (AppCompatButton) view.findViewById(R.id.search_country_button);
searchCountryButton.setVisibility(View.VISIBLE);
searchCountryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchCountryMap();
}
});
break;
case MAP_DOWNLOAD:
if (localMapIndexItem != null) {
@ -455,6 +464,13 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
}
}
private void searchCountryMap() {
closeWizard();
final Intent intent = new Intent(getActivity(), DownloadActivity.class);
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
getActivity().startActivity(intent);
}
private void searchMap() {
if (location != null) {
int point31x = MapUtils.get31TileNumberX(location.getLongitude());