diff --git a/OsmAnd/res/layout/dash_dashboard_or_drawer_fragment.xml b/OsmAnd/res/layout/dash_dashboard_or_drawer_fragment.xml
new file mode 100644
index 0000000000..65f6cadc7c
--- /dev/null
+++ b/OsmAnd/res/layout/dash_dashboard_or_drawer_fragment.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/free_version_banner.xml b/OsmAnd/res/layout/free_version_banner.xml
index 01ff844ba0..6c7b8d2a53 100644
--- a/OsmAnd/res/layout/free_version_banner.xml
+++ b/OsmAnd/res/layout/free_version_banner.xml
@@ -55,108 +55,13 @@
android:max="10"
android:progressDrawable="@drawable/number_of_downloads_progress_bar_drawable"
android:saveEnabled="false"
- tools:progress="5"/>
+ tools:progress="6"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:orientation="horizontal"/>
Reparación de electrodomésticos
+Pirotecnia
+
diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml
index dc111c8d97..1b2a7bb1d2 100644
--- a/OsmAnd/res/values-es-rAR/strings.xml
+++ b/OsmAnd/res/values-es-rAR/strings.xml
@@ -1979,5 +1979,5 @@
Estilo de carretera
Reabrir
Guardar sin conexión
- " • 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... "
+ " • 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... "
diff --git a/OsmAnd/res/values-es/phrases.xml b/OsmAnd/res/values-es/phrases.xml
index ff26dee9cb..67eadcdd14 100644
--- a/OsmAnd/res/values-es/phrases.xml
+++ b/OsmAnd/res/values-es/phrases.xml
@@ -2488,4 +2488,6 @@
Wiki Min del sur
Wiki baskir
Wiki lombard
-
+ Tienda de pirotecnia
+
+
diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml
index 91bd9472c4..041ca453ec 100644
--- a/OsmAnd/res/values-es/strings.xml
+++ b/OsmAnd/res/values-es/strings.xml
@@ -1976,5 +1976,5 @@
Ancho del GPX
Estilo de carretera
Guardar sin conexión
- " • 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... "
+ " • 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... "
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 9099e61f20..b5b7a830ce 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -2087,5 +2087,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Map legend
Do you really want to save poi without POI type?
Modify OSM change
+ Use dashboard
+ Use drawer
+ New menu
+ You can choose what to use, Dashboard or Drawer menu. You can change this later in settings.
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index d58a653779..b2d3750705 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -635,9 +635,9 @@ public class OsmandSettings {
}
public final CommonPreference USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
- public final CommonPreference SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
- public final CommonPreference SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
- public final CommonPreference SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
+ public final CommonPreference SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", true).makeGlobal();
+ public final CommonPreference SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", true).makeGlobal();
+ public final CommonPreference 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
public final CommonPreference USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache();
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashDashboardOrDrawerFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashDashboardOrDrawerFragment.java
new file mode 100644
index 0000000000..b2e3b33475
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashDashboardOrDrawerFragment.java
@@ -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() {
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashErrorFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashErrorFragment.java
index 71a239076c..c8a5cfe1f5 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashErrorFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashErrorFragment.java
@@ -30,10 +30,6 @@ import net.osmand.plus.helpers.FontCache;
import java.io.File;
import java.text.MessageFormat;
-/**
- * Created by Denis
- * on 02.12.14.
- */
public class DashErrorFragment extends DashBaseFragment {
public static final String TAG = "DASH_ERROR_FRAGMENT";
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
index f0e4fd5452..3f07f54dbe 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
@@ -75,6 +75,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
DashRateUsFragment.SHOULD_SHOW_FUNCTION, 0, null),
+ new DashFragmentData(DashDashboardOrDrawerFragment.TAG, DashDashboardOrDrawerFragment.class,
+ DashDashboardOrDrawerFragment.SHOULD_SHOW_FUNCTION, 5, null),
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
DashErrorFragment.SHOULD_SHOW_FUNCTION, 30, null),
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
index 48ea7cbfa4..0ed424bd63 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
@@ -21,7 +21,9 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.ProgressBar;
+import android.widget.Space;
import android.widget.TextView;
import android.widget.Toast;
@@ -115,6 +117,8 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
setContentView(R.layout.download);
+ //noinspection ConstantConditions
+ getSupportActionBar().setTitle(R.string.shared_string_map);
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
downloadProgressLayout.setVisibility(View.VISIBLE);
updateDescriptionTextWithSize(this, downloadProgressLayout);
@@ -145,22 +149,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
mSlidingTabLayout.setViewPager(viewPager);
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);
final Intent intent = getIntent();
@@ -175,15 +163,15 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
public DownloadIndexesThread getDownloadThread() {
return downloadThread;
}
-
+
public void startDownload(IndexItem... indexItem) {
downloadValidationManager.startDownload(this, indexItem);
}
-
+
public void makeSureUserCancelDownload(IndexItem item) {
downloadValidationManager.makeSureUserCancelDownload(this, item);
}
-
+
@Override
public void onAttachFragment(Fragment fragment) {
fragSet.add(new WeakReference(fragment));
@@ -218,7 +206,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
public List getLocalIndexInfos() {
return localIndexInfos;
}
-
+
public OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication();
}
@@ -234,11 +222,11 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
@UiThread
public void downloadHasFinished() {
visibleBanner.updateBannerInProgress();
- if(downloadItem != null && downloadItem != getMyApplication().getRegions().getWorldRegion()
+ if (downloadItem != null && downloadItem != getMyApplication().getRegions().getWorldRegion()
&& !WorldRegion.WORLD_BASEMAP.equals(downloadItem.getRegionDownloadNameLC())) {
boolean firstMap = !getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.get();
- if(firstMap) {
+ if (firstMap) {
initSettingsFirstMap(downloadItem);
}
showGoToMap(downloadItem);
@@ -252,8 +240,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
}
-
-
@Override
@UiThread
@@ -268,7 +254,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
}
-
@Override
@UiThread
@@ -287,10 +272,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
return viewPager.getCurrentItem();
}
- public boolean isLightActionBar() {
- return ((OsmandApplication) getApplication()).getSettings().isLightActionBar();
- }
-
public void showDialog(FragmentActivity activity, DialogFragment fragment) {
fragment.show(activity.getSupportFragmentManager(), "dialog");
}
@@ -372,7 +353,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
initFreeVersionBanner();
updateBannerInProgress();
}
-
+
public void updateBannerInProgress() {
BasicProgressAsyncTask, ?, ?, ?> basicProgressAsyncTask = ctx.getDownloadThread().getCurrentRunningTask();
final boolean isFinished = basicProgressAsyncTask == null
@@ -442,8 +423,33 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
}
});
- laterButton.setOnClickListener(new ToggleCollapseFreeVersionBanner(freeVersionDescriptionTextView,
- buttonsLinearLayout, freeVersionBannerTitle, application.getSettings()));
+ ToggleCollapseFreeVersionBanner clickListener =
+ 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();
}
@@ -528,10 +534,10 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
RegionParams params = reg.getParams();
boolean americanSigns = "american".equals(params.getRegionRoadSigns());
boolean leftHand = "yes".equals(params.getRegionLeftHandDriving());
- MetricsConstants mc = "miles".equals(params.getRegionMetric()) ?
+ MetricsConstants mc = "miles".equals(params.getRegionMetric()) ?
MetricsConstants.MILES_AND_FOOTS : MetricsConstants.KILOMETERS_AND_METERS;
for (DrivingRegion r : DrivingRegion.values()) {
- if(r.americanSigns == americanSigns && r.leftHandDriving == leftHand &&
+ if (r.americanSigns == americanSigns && r.leftHandDriving == leftHand &&
r.defMetrics == mc) {
drg = r;
break;
@@ -557,28 +563,28 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
}
}
-
+
public void setDownloadItem(WorldRegion region) {
- if(downloadItem == null) {
+ if (downloadItem == null) {
downloadItem = region;
- } else if(region == null) {
+ } else if (region == null) {
downloadItem = null;
}
}
-
+
private void showGoToMap(WorldRegion region) {
GoToMapFragment fragment = new GoToMapFragment();
fragment.regionCenter = region.getRegionCenter();
fragment.regionName = region.getLocaleName();
fragment.show(getFragmentManager(), GoToMapFragment.TAG);
}
-
+
private void showDownloadWorldMapIfNeeded() {
- if(getDownloadThread().getCurrentDownloadingItem() == null) {
+ if (getDownloadThread().getCurrentDownloadingItem() == null) {
return;
}
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)) {
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
@@ -586,7 +592,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
fragment.show(getFragmentManager(), AskMapDownloadFragment.TAG);
}
}
-
+
private void showFirstTimeExternalStorage() {
final boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(this);
final boolean externalExists =
@@ -742,9 +748,8 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
}
-
}
-
+
public static class GoToMapFragment extends BottomSheetDialogFragment {
public static final String TAG = "GoToMapFragment";
@@ -776,7 +781,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
closeImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(getActivity() instanceof DownloadActivity) {
+ if (getActivity() instanceof DownloadActivity) {
((DownloadActivity) getActivity()).setDownloadItem(null);
}
dismiss();
@@ -803,8 +808,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
outState.putSerializable(KEY_GOTO_MAP_REGION_CENTER, regionCenter);
}
-
-
+
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java b/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
index 3a74d29639..ef717fa624 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
@@ -23,7 +23,7 @@ import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import java.text.MessageFormat;
public class DownloadValidationManager {
- public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 5;
+ public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 7;
protected OsmandSettings settings;
private OsmandApplication app;
private DownloadIndexesThread downloadThread;
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java
index 1fc18ae165..bff6204045 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java
@@ -3,7 +3,9 @@ package net.osmand.plus.download.ui;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
+import android.support.v7.internal.view.ContextThemeWrapper;
import android.support.v7.widget.Toolbar;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -49,7 +51,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
private SearchListAdapter listAdapter;
private BannerAndDownloadFreeVersion banner;
private String searchText;
- private SearchView search;
+ private SearchView searchView;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -100,17 +102,19 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
listView.setOnItemClickListener(this);
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(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 0, 0);
- search.setLayoutParams(params);
- toolbar.addView(search);
+ searchView.setLayoutParams(params);
+ toolbar.addView(searchView);
- search.setOnCloseListener(new SearchView.OnCloseListener() {
+ searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
- if (search.getQuery().length() == 0) {
+ if (searchView.getQuery().length() == 0) {
dismiss();
return true;
}
@@ -118,13 +122,13 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
}
});
- search.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
+ searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
}
});
- search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
+ searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
@@ -181,9 +185,9 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
@Override
public void onResume() {
super.onResume();
- search.setIconified(false);
+ searchView.setIconified(false);
if (!Algorithms.isEmpty(searchText)) {
- search.setQuery(searchText, true);
+ searchView.setQuery(searchText, true);
}
}