Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
ed7fe6547b
14 changed files with 196 additions and 166 deletions
56
OsmAnd/res/layout/dash_dashboard_or_drawer_fragment.xml
Normal file
56
OsmAnd/res/layout/dash_dashboard_or_drawer_fragment.xml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout android:id="@+id/main_fav"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/dash_margin"
|
||||||
|
android:layout_marginLeft="@dimen/dash_margin_h"
|
||||||
|
android:layout_marginRight="@dimen/dash_margin_h"
|
||||||
|
android:layout_marginTop="@dimen/dash_margin"
|
||||||
|
android:background="?attr/bg_card"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/header"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingLeft="@dimen/list_content_padding"
|
||||||
|
android:paddingRight="@dimen/list_content_padding"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:text="@string/dashboard_or_drawer_title"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="20sp"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subheader"
|
||||||
|
style="@style/DashboardSubHeader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/list_content_padding"
|
||||||
|
android:text="@string/dashboard_or_drawer_description"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="@dimen/list_header_height"
|
||||||
|
android:gravity="right"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
|
android:id="@+id/useDashboardButton"
|
||||||
|
style="@style/DashboardGeneralButton"
|
||||||
|
android:text="@string/use_dashboard"
|
||||||
|
osmand:textAllCapsCompat="true"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
|
android:id="@+id/useDrawerButton"
|
||||||
|
style="@style/DashboardGeneralButton"
|
||||||
|
android:text="@string/use_drawer"
|
||||||
|
osmand:textAllCapsCompat="true"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -55,108 +55,13 @@
|
||||||
android:max="10"
|
android:max="10"
|
||||||
android:progressDrawable="@drawable/number_of_downloads_progress_bar_drawable"
|
android:progressDrawable="@drawable/number_of_downloads_progress_bar_drawable"
|
||||||
android:saveEnabled="false"
|
android:saveEnabled="false"
|
||||||
tools:progress="5"/>
|
tools:progress="6"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/marksLinearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"/>
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/color_black"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -2484,4 +2484,6 @@
|
||||||
|
|
||||||
<string name="poi_craft_electronics">Reparación de electrodomésticos</string>
|
<string name="poi_craft_electronics">Reparación de electrodomésticos</string>
|
||||||
|
|
||||||
|
<string name="poi_fireworks">Pirotecnia</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1979,5 +1979,5 @@
|
||||||
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
|
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
|
||||||
<string name="poi_dialog_reopen">Reabrir</string>
|
<string name="poi_dialog_reopen">Reabrir</string>
|
||||||
<string name="osm_save_offline">Guardar sin conexión</string>
|
<string name="osm_save_offline">Guardar sin conexión</string>
|
||||||
<string name="release_2_2">" • Nueva interfaz de usuario sensible al contexto para aprovechar lugares en el mapa y en otra pantallas\n\n• La pantalla del mapa, ahora se inicia directamente, a menos que \'Mostrar panel de control en el arranque de la aplicación\' este seleccionado\n\n• El tablero de instrumentos, posee el opción de que tarjetas se visualizarán\n\n• Los mapas, pueden seleccionarse directamente y descargar el mapa mundial\n\n• Mejor recálculo de la ruta (después de reiterados intentos, el motor ahora sugiere una ruta diferente)\n\n• La búsqueda de PDI, ahora soporta consultas más específicas\n\n• Mejoras en PDI y funcionalidad de edición OSM\n\n• Se rediseñó la estructura e interfaz de los datos de mapas\n\n y más... "</string>
|
<string name="release_2_2">" • Nueva interfaz de usuario sensible al contexto para aprovechar lugares en el mapa y en otra pantallas\n\n• La pantalla del mapa, ahora se inicia directamente, a menos que \'Mostrar panel de control en el arranque de la aplicación\' este seleccionado\n\n• Configura cuál y cómo se mostrarán las tarjetas en el panel de instrumentos\n\n• Para descargar mapas, las regiones pueden seleccionarse directamente pulsando sobre el mapa mundial\n\n• Mejor recálculo de la ruta (después de reiterados intentos, el motor ahora sugiere una ruta diferente)\n\n• La búsqueda de PDI, ahora soporta consultas más específicas\n\n• Mejoras en PDI y funcionalidad de edición OSM\n\n• Se rediseñó la estructura e interfaz de los datos de mapas\n\n y más... "</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2488,4 +2488,6 @@
|
||||||
<string name="poi_wiki_lang_zhminnan">Wiki Min del sur</string>
|
<string name="poi_wiki_lang_zhminnan">Wiki Min del sur</string>
|
||||||
<string name="poi_wiki_lang_ba">Wiki baskir</string>
|
<string name="poi_wiki_lang_ba">Wiki baskir</string>
|
||||||
<string name="poi_wiki_lang_lmo">Wiki lombard</string>
|
<string name="poi_wiki_lang_lmo">Wiki lombard</string>
|
||||||
</resources>
|
<string name="poi_fireworks">Tienda de pirotecnia</string>
|
||||||
|
|
||||||
|
</resources>
|
||||||
|
|
|
@ -1976,5 +1976,5 @@
|
||||||
<string name="rendering_attr_currentTrackWidth_description">Ancho del GPX</string>
|
<string name="rendering_attr_currentTrackWidth_description">Ancho del GPX</string>
|
||||||
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
|
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
|
||||||
<string name="osm_save_offline">Guardar sin conexión</string>
|
<string name="osm_save_offline">Guardar sin conexión</string>
|
||||||
<string name="release_2_2">" • Nueva interfaz de usuario sensible al contexto para aprovechar lugares en el mapa y en otra pantallas\n\n• La pantalla del mapa, ahora se inicia directamente, a menos que \'Mostrar panel de control en el arranque de la aplicación\' este seleccionado\n\n• El tablero de instrumentos, posee el opción de que tarjetas se visualizarán\n\n• Los mapas, pueden seleccionarse directamente y descargar el mapa mundial\n\n• Mejor recálculo de la ruta (después de reiterados intentos, el motor ahora sugiere una ruta diferente)\n\n• La búsqueda de PDI, ahora soporta consultas más específicas\n\n• Mejoras en PDI y funcionalidad de edición OSM\n\n• Se rediseñó la estructura e interfaz de los datos de mapas\n\n y más... "</string>
|
<string name="release_2_2">" • Nueva interfaz de usuario sensible al contexto para aprovechar lugares en el mapa y en otra pantallas\n\n• La pantalla del mapa, ahora se inicia directamente, a menos que \'Mostrar panel de control en el arranque de la aplicación\' este seleccionado\n\n• Configura cuál y cómo se mostrarán las tarjetas en el panel de instrumentos\n\n• Para descargar mapas, las regiones pueden seleccionarse directamente pulsando sobre el mapa mundial\n\n• Mejor recálculo de la ruta (después de reiterados intentos, el motor ahora sugiere una ruta diferente)\n\n• La búsqueda de PDI, ahora soporta consultas más específicas\n\n• Mejoras en PDI y funcionalidad de edición OSM\n\n• Se rediseñó la estructura e interfaz de los datos de mapas\n\n y más... "</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2087,5 +2087,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="map_legend">Map legend</string>
|
<string name="map_legend">Map legend</string>
|
||||||
<string name="save_poi_without_poi_type_message">Do you really want to save poi without POI type?</string>
|
<string name="save_poi_without_poi_type_message">Do you really want to save poi without POI type?</string>
|
||||||
<string name="poi_context_menu_modify_osm_change">Modify OSM change</string>
|
<string name="poi_context_menu_modify_osm_change">Modify OSM change</string>
|
||||||
|
<string name="use_dashboard">Use dashboard</string>
|
||||||
|
<string name="use_drawer">Use drawer</string>
|
||||||
|
<string name="dashboard_or_drawer_title">New menu</string>
|
||||||
|
<string name="dashboard_or_drawer_description">You can choose what to use, Dashboard or Drawer menu. You can change this later in settings.</string>
|
||||||
<!-- string name="map_legend_item_description">Legend for OsmAnd default map style, Internet connectivity needed to display</string -->
|
<!-- string name="map_legend_item_description">Legend for OsmAnd default map style, Internet connectivity needed to display</string -->
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -635,9 +635,9 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
|
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", true).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", true).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", true).makeGlobal();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final CommonPreference<Boolean> USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache();
|
public final CommonPreference<Boolean> USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache();
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
|
|
||||||
|
public class DashDashboardOrDrawerFragment extends DashBaseFragment {
|
||||||
|
|
||||||
|
public static final String TAG = "DASH_DASHBOARD_OR_DRAWER_FRAGMENT";
|
||||||
|
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
|
||||||
|
new DashFragmentData.ShouldShowFunction() {
|
||||||
|
// If settings null. No changes in setting will be made.
|
||||||
|
@Override
|
||||||
|
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||||
|
return settings.SHOW_CARD_TO_CHOOSE_DRAWER.get();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private DismissListener dismissCallback;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_dashboard_or_drawer_fragment, container, false);
|
||||||
|
view.findViewById(R.id.useDashboardButton).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final OsmandSettings settings = getMyApplication().getSettings();
|
||||||
|
settings.SHOW_DASHBOARD_ON_START.set(true);
|
||||||
|
settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(true);
|
||||||
|
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
|
||||||
|
dashboard.hideFragmentByTag(TAG);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
view.findViewById(R.id.useDrawerButton).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final OsmandSettings settings = getMyApplication().getSettings();
|
||||||
|
settings.SHOW_DASHBOARD_ON_START.set(false);
|
||||||
|
settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(false);
|
||||||
|
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
|
||||||
|
dashboard.hideFragmentByTag(TAG);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOpenDash() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,10 +30,6 @@ import net.osmand.plus.helpers.FontCache;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Denis
|
|
||||||
* on 02.12.14.
|
|
||||||
*/
|
|
||||||
public class DashErrorFragment extends DashBaseFragment {
|
public class DashErrorFragment extends DashBaseFragment {
|
||||||
|
|
||||||
public static final String TAG = "DASH_ERROR_FRAGMENT";
|
public static final String TAG = "DASH_ERROR_FRAGMENT";
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
|
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
|
||||||
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
|
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
|
||||||
DashRateUsFragment.SHOULD_SHOW_FUNCTION, 0, null),
|
DashRateUsFragment.SHOULD_SHOW_FUNCTION, 0, null),
|
||||||
|
new DashFragmentData(DashDashboardOrDrawerFragment.TAG, DashDashboardOrDrawerFragment.class,
|
||||||
|
DashDashboardOrDrawerFragment.SHOULD_SHOW_FUNCTION, 5, null),
|
||||||
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
|
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
|
||||||
DashErrorFragment.SHOULD_SHOW_FUNCTION, 30, null),
|
DashErrorFragment.SHOULD_SHOW_FUNCTION, 30, null),
|
||||||
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
|
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
|
||||||
|
|
|
@ -21,7 +21,9 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Space;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -115,6 +117,8 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(R.layout.download);
|
setContentView(R.layout.download);
|
||||||
|
//noinspection ConstantConditions
|
||||||
|
getSupportActionBar().setTitle(R.string.shared_string_map);
|
||||||
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
|
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
|
||||||
downloadProgressLayout.setVisibility(View.VISIBLE);
|
downloadProgressLayout.setVisibility(View.VISIBLE);
|
||||||
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
||||||
|
@ -145,22 +149,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
mSlidingTabLayout.setViewPager(viewPager);
|
mSlidingTabLayout.setViewPager(viewPager);
|
||||||
|
|
||||||
viewPager.setCurrentItem(currentTab);
|
viewPager.setCurrentItem(currentTab);
|
||||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int i, float v, int i1) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageSelected(int i) {
|
|
||||||
visibleBanner.updateBannerInProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int i) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this, true);
|
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this, true);
|
||||||
|
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
|
@ -234,11 +222,11 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
@UiThread
|
@UiThread
|
||||||
public void downloadHasFinished() {
|
public void downloadHasFinished() {
|
||||||
visibleBanner.updateBannerInProgress();
|
visibleBanner.updateBannerInProgress();
|
||||||
if(downloadItem != null && downloadItem != getMyApplication().getRegions().getWorldRegion()
|
if (downloadItem != null && downloadItem != getMyApplication().getRegions().getWorldRegion()
|
||||||
&& !WorldRegion.WORLD_BASEMAP.equals(downloadItem.getRegionDownloadNameLC())) {
|
&& !WorldRegion.WORLD_BASEMAP.equals(downloadItem.getRegionDownloadNameLC())) {
|
||||||
|
|
||||||
boolean firstMap = !getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.get();
|
boolean firstMap = !getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.get();
|
||||||
if(firstMap) {
|
if (firstMap) {
|
||||||
initSettingsFirstMap(downloadItem);
|
initSettingsFirstMap(downloadItem);
|
||||||
}
|
}
|
||||||
showGoToMap(downloadItem);
|
showGoToMap(downloadItem);
|
||||||
|
@ -253,8 +241,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@UiThread
|
@UiThread
|
||||||
public void downloadInProgress() {
|
public void downloadInProgress() {
|
||||||
|
@ -269,7 +255,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@UiThread
|
@UiThread
|
||||||
public void newDownloadIndexes() {
|
public void newDownloadIndexes() {
|
||||||
|
@ -287,10 +272,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
return viewPager.getCurrentItem();
|
return viewPager.getCurrentItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLightActionBar() {
|
|
||||||
return ((OsmandApplication) getApplication()).getSettings().isLightActionBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showDialog(FragmentActivity activity, DialogFragment fragment) {
|
public void showDialog(FragmentActivity activity, DialogFragment fragment) {
|
||||||
fragment.show(activity.getSupportFragmentManager(), "dialog");
|
fragment.show(activity.getSupportFragmentManager(), "dialog");
|
||||||
}
|
}
|
||||||
|
@ -442,8 +423,33 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
laterButton.setOnClickListener(new ToggleCollapseFreeVersionBanner(freeVersionDescriptionTextView,
|
ToggleCollapseFreeVersionBanner clickListener =
|
||||||
buttonsLinearLayout, freeVersionBannerTitle, application.getSettings()));
|
new ToggleCollapseFreeVersionBanner(freeVersionDescriptionTextView,
|
||||||
|
buttonsLinearLayout, freeVersionBannerTitle, application.getSettings());
|
||||||
|
laterButton.setOnClickListener(clickListener);
|
||||||
|
|
||||||
|
LinearLayout marksLinearLayout = (LinearLayout) freeVersionBanner.findViewById(R.id.marksLinearLayout);
|
||||||
|
Space spaceView = new Space(ctx);
|
||||||
|
LinearLayout.LayoutParams layoutParams =
|
||||||
|
new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
|
||||||
|
spaceView.setLayoutParams(layoutParams);
|
||||||
|
marksLinearLayout.addView(spaceView);
|
||||||
|
int markWidth = (int) (1 * ctx.getResources().getDisplayMetrics().density);
|
||||||
|
int colorBlack = ctx.getResources().getColor(R.color.color_black);
|
||||||
|
for (int i = 1; i < DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS; i++) {
|
||||||
|
View markView = new View(ctx);
|
||||||
|
layoutParams = new LinearLayout.LayoutParams(markWidth, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
markView.setLayoutParams(layoutParams);
|
||||||
|
markView.setBackgroundColor(colorBlack);
|
||||||
|
marksLinearLayout.addView(markView);
|
||||||
|
spaceView = new Space(ctx);
|
||||||
|
layoutParams = new LinearLayout.LayoutParams(0,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT, 1);
|
||||||
|
spaceView.setLayoutParams(layoutParams);
|
||||||
|
marksLinearLayout.addView(spaceView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
updateFreeVersionBanner();
|
updateFreeVersionBanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +537,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
MetricsConstants mc = "miles".equals(params.getRegionMetric()) ?
|
MetricsConstants mc = "miles".equals(params.getRegionMetric()) ?
|
||||||
MetricsConstants.MILES_AND_FOOTS : MetricsConstants.KILOMETERS_AND_METERS;
|
MetricsConstants.MILES_AND_FOOTS : MetricsConstants.KILOMETERS_AND_METERS;
|
||||||
for (DrivingRegion r : DrivingRegion.values()) {
|
for (DrivingRegion r : DrivingRegion.values()) {
|
||||||
if(r.americanSigns == americanSigns && r.leftHandDriving == leftHand &&
|
if (r.americanSigns == americanSigns && r.leftHandDriving == leftHand &&
|
||||||
r.defMetrics == mc) {
|
r.defMetrics == mc) {
|
||||||
drg = r;
|
drg = r;
|
||||||
break;
|
break;
|
||||||
|
@ -559,9 +565,9 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadItem(WorldRegion region) {
|
public void setDownloadItem(WorldRegion region) {
|
||||||
if(downloadItem == null) {
|
if (downloadItem == null) {
|
||||||
downloadItem = region;
|
downloadItem = region;
|
||||||
} else if(region == null) {
|
} else if (region == null) {
|
||||||
downloadItem = null;
|
downloadItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -574,11 +580,11 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDownloadWorldMapIfNeeded() {
|
private void showDownloadWorldMapIfNeeded() {
|
||||||
if(getDownloadThread().getCurrentDownloadingItem() == null) {
|
if (getDownloadThread().getCurrentDownloadingItem() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IndexItem worldMap = getDownloadThread().getIndexes().getWorldBaseMapItem();
|
IndexItem worldMap = getDownloadThread().getIndexes().getWorldBaseMapItem();
|
||||||
if(!SUGGESTED_TO_DOWNLOAD_BASEMAP && worldMap != null && (!worldMap.isDownloaded() || worldMap.isOutdated()) &&
|
if (!SUGGESTED_TO_DOWNLOAD_BASEMAP && worldMap != null && (!worldMap.isDownloaded() || worldMap.isOutdated()) &&
|
||||||
!getDownloadThread().isDownloading(worldMap)) {
|
!getDownloadThread().isDownloading(worldMap)) {
|
||||||
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
|
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
|
||||||
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
|
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
|
||||||
|
@ -742,7 +748,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GoToMapFragment extends BottomSheetDialogFragment {
|
public static class GoToMapFragment extends BottomSheetDialogFragment {
|
||||||
|
@ -776,7 +781,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
closeImageButton.setOnClickListener(new View.OnClickListener() {
|
closeImageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(getActivity() instanceof DownloadActivity) {
|
if (getActivity() instanceof DownloadActivity) {
|
||||||
((DownloadActivity) getActivity()).setDownloadItem(null);
|
((DownloadActivity) getActivity()).setDownloadItem(null);
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -804,7 +809,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
public class DownloadValidationManager {
|
public class DownloadValidationManager {
|
||||||
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 5;
|
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 7;
|
||||||
protected OsmandSettings settings;
|
protected OsmandSettings settings;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private DownloadIndexesThread downloadThread;
|
private DownloadIndexesThread downloadThread;
|
||||||
|
|
|
@ -3,7 +3,9 @@ package net.osmand.plus.download.ui;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v7.internal.view.ContextThemeWrapper;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -49,7 +51,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
||||||
private SearchListAdapter listAdapter;
|
private SearchListAdapter listAdapter;
|
||||||
private BannerAndDownloadFreeVersion banner;
|
private BannerAndDownloadFreeVersion banner;
|
||||||
private String searchText;
|
private String searchText;
|
||||||
private SearchView search;
|
private SearchView searchView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -100,17 +102,19 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
||||||
listView.setOnItemClickListener(this);
|
listView.setOnItemClickListener(this);
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
search = new SearchView(getActivity());
|
TypedValue typedValue = new TypedValue();
|
||||||
|
getActivity().getTheme().resolveAttribute(R.attr.toolbar_theme, typedValue, true);
|
||||||
|
searchView = new SearchView(new ContextThemeWrapper(getActivity(), typedValue.data));
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
||||||
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||||
params.setMargins(0, 0, 0, 0);
|
params.setMargins(0, 0, 0, 0);
|
||||||
search.setLayoutParams(params);
|
searchView.setLayoutParams(params);
|
||||||
toolbar.addView(search);
|
toolbar.addView(searchView);
|
||||||
|
|
||||||
search.setOnCloseListener(new SearchView.OnCloseListener() {
|
searchView.setOnCloseListener(new SearchView.OnCloseListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClose() {
|
public boolean onClose() {
|
||||||
if (search.getQuery().length() == 0) {
|
if (searchView.getQuery().length() == 0) {
|
||||||
dismiss();
|
dismiss();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,13 +122,13 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
search.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
|
searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -181,9 +185,9 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
search.setIconified(false);
|
searchView.setIconified(false);
|
||||||
if (!Algorithms.isEmpty(searchText)) {
|
if (!Algorithms.isEmpty(searchText)) {
|
||||||
search.setQuery(searchText, true);
|
searchView.setQuery(searchText, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue